作者 邓超

xxx

... ... @@ -581,6 +581,23 @@ class Home extends Base {
}
/**
* 执行清空邮件操作
* @throws \Lib\Err
* @author:dc
* @time 2024/3/14 14:18
*/
public function expunge(){
$email = $this->getEmail();
$mailInstance = new Mail($email['email'],base64_decode($email['password']),$email['imap']);
if($mailInstance->expunge()){
app()->_json([]);
}
app()->e('执行失败');
}
/**
... ...
... ... @@ -555,6 +555,24 @@ class Imap {
}
/**
* 清除 已标记为删除的邮件 不可逆
* @return bool
* @throws \Exception
* @author:dc
* @time 2024/3/14 14:12
*/
public function expunge(){
$res = $this->request("EXPUNGE");
if ($res[0] == 'ok'){
return true;
}
throw new \Exception(end($res[1]));
}
/**
* 删除邮件
* @param array $uids
* @author:dc
... ...
... ... @@ -595,6 +595,15 @@ class Mail {
}
/**
* 清空标记为已删除的邮件,不可还原邮件
* @author:dc
* @time 2024/3/14 14:11
*/
public function expunge(){
return $this->client->expunge();
}
// /**
// * 删除
... ...
... ... @@ -38,6 +38,8 @@ return [
'move' => [\Controller\Home::class, 'move'],
// 复制邮件
'copy' => [\Controller\Home::class, 'copy'],
// 清除邮件
'expunge' => [\Controller\Home::class, 'expunge'],
// 检查邮箱状态
'check' => [\Controller\Home::class, 'check'],
... ...