正在显示
4 个修改的文件
包含
46 行增加
和
0 行删除
| @@ -581,6 +581,23 @@ class Home extends Base { | @@ -581,6 +581,23 @@ class Home extends Base { | ||
| 581 | } | 581 | } |
| 582 | 582 | ||
| 583 | 583 | ||
| 584 | + /** | ||
| 585 | + * 执行清空邮件操作 | ||
| 586 | + * @throws \Lib\Err | ||
| 587 | + * @author:dc | ||
| 588 | + * @time 2024/3/14 14:18 | ||
| 589 | + */ | ||
| 590 | + public function expunge(){ | ||
| 591 | + $email = $this->getEmail(); | ||
| 592 | + $mailInstance = new Mail($email['email'],base64_decode($email['password']),$email['imap']); | ||
| 593 | + if($mailInstance->expunge()){ | ||
| 594 | + app()->_json([]); | ||
| 595 | + } | ||
| 596 | + | ||
| 597 | + app()->e('执行失败'); | ||
| 598 | + } | ||
| 599 | + | ||
| 600 | + | ||
| 584 | 601 | ||
| 585 | 602 | ||
| 586 | /** | 603 | /** |
| @@ -555,6 +555,24 @@ class Imap { | @@ -555,6 +555,24 @@ class Imap { | ||
| 555 | } | 555 | } |
| 556 | 556 | ||
| 557 | /** | 557 | /** |
| 558 | + * 清除 已标记为删除的邮件 不可逆 | ||
| 559 | + * @return bool | ||
| 560 | + * @throws \Exception | ||
| 561 | + * @author:dc | ||
| 562 | + * @time 2024/3/14 14:12 | ||
| 563 | + */ | ||
| 564 | + public function expunge(){ | ||
| 565 | + | ||
| 566 | + $res = $this->request("EXPUNGE"); | ||
| 567 | + | ||
| 568 | + if ($res[0] == 'ok'){ | ||
| 569 | + return true; | ||
| 570 | + } | ||
| 571 | + | ||
| 572 | + throw new \Exception(end($res[1])); | ||
| 573 | + } | ||
| 574 | + | ||
| 575 | + /** | ||
| 558 | * 删除邮件 | 576 | * 删除邮件 |
| 559 | * @param array $uids | 577 | * @param array $uids |
| 560 | * @author:dc | 578 | * @author:dc |
| @@ -595,6 +595,15 @@ class Mail { | @@ -595,6 +595,15 @@ class Mail { | ||
| 595 | 595 | ||
| 596 | } | 596 | } |
| 597 | 597 | ||
| 598 | + /** | ||
| 599 | + * 清空标记为已删除的邮件,不可还原邮件 | ||
| 600 | + * @author:dc | ||
| 601 | + * @time 2024/3/14 14:11 | ||
| 602 | + */ | ||
| 603 | + public function expunge(){ | ||
| 604 | + return $this->client->expunge(); | ||
| 605 | + } | ||
| 606 | + | ||
| 598 | 607 | ||
| 599 | // /** | 608 | // /** |
| 600 | // * 删除 | 609 | // * 删除 |
| @@ -38,6 +38,8 @@ return [ | @@ -38,6 +38,8 @@ return [ | ||
| 38 | 'move' => [\Controller\Home::class, 'move'], | 38 | 'move' => [\Controller\Home::class, 'move'], |
| 39 | // 复制邮件 | 39 | // 复制邮件 |
| 40 | 'copy' => [\Controller\Home::class, 'copy'], | 40 | 'copy' => [\Controller\Home::class, 'copy'], |
| 41 | + // 清除邮件 | ||
| 42 | + 'expunge' => [\Controller\Home::class, 'expunge'], | ||
| 41 | // 检查邮箱状态 | 43 | // 检查邮箱状态 |
| 42 | 'check' => [\Controller\Home::class, 'check'], | 44 | 'check' => [\Controller\Home::class, 'check'], |
| 43 | 45 |
-
请 注册 或 登录 后发表评论