正在显示
2 个修改的文件
包含
24 行增加
和
10 行删除
@@ -41,12 +41,31 @@ class MailBlack { | @@ -41,12 +41,31 @@ class MailBlack { | ||
41 | $this->blackFolder = $this->db->cache(3600)->value(folderSql::originFolder($data['email_id'],'垃圾箱')); | 41 | $this->blackFolder = $this->db->cache(3600)->value(folderSql::originFolder($data['email_id'],'垃圾箱')); |
42 | } | 42 | } |
43 | 43 | ||
44 | + $this->check(); | ||
44 | 45 | ||
46 | + } | ||
45 | 47 | ||
46 | 48 | ||
47 | - | 49 | + protected function check(){ |
50 | + | ||
51 | + // 验证是否存在黑名单中 | ||
52 | + if($this->blacklist && $this->blackFolder != $folder){ | ||
53 | + // 邮箱是否在黑名单中 | ||
54 | + $isBlacklist = false; | ||
55 | + if (!empty($blacklist['emails']) && is_array($blacklist['emails']) && in_array($this->data['from'],$blacklist['emails'])){ | ||
56 | + $isBlacklist = true; | ||
57 | + } | ||
58 | + // 域是否存在 | ||
59 | + if (!empty($blacklist['domain']) && is_array($blacklist['domain']) && in_array(explode('@',$this->data['from'])[1],$blacklist['domain'])){ | ||
60 | + $isBlacklist = true; | ||
61 | + } | ||
62 | + | ||
63 | + if($isBlacklist && $this->blackFolder){ | ||
64 | + // 移入垃圾箱 | ||
65 | + $this->client->move([$this->data['uid']],$this->blackFolder); | ||
66 | + } | ||
67 | + } | ||
48 | 68 | ||
49 | } | 69 | } |
50 | 70 | ||
51 | - | ||
52 | } | 71 | } |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | namespace Lib\Mail; | 3 | namespace Lib\Mail; |
4 | 4 | ||
5 | +use Event\Event; | ||
5 | use Event\syncMail; | 6 | use Event\syncMail; |
6 | use Lib\DbPool; | 7 | use Lib\DbPool; |
7 | use Model\bodySql; | 8 | use Model\bodySql; |
@@ -287,7 +288,7 @@ class Mail { | @@ -287,7 +288,7 @@ class Mail { | ||
287 | unset($uids[$k]); | 288 | unset($uids[$k]); |
288 | } | 289 | } |
289 | } | 290 | } |
290 | - | 291 | + |
291 | 292 | ||
292 | $msgno += $nu; | 293 | $msgno += $nu; |
293 | 294 | ||
@@ -442,13 +443,7 @@ class Mail { | @@ -442,13 +443,7 @@ class Mail { | ||
442 | try { | 443 | try { |
443 | $id = $db->throw()->insert(listsSql::$table,$data); | 444 | $id = $db->throw()->insert(listsSql::$table,$data); |
444 | if($id){ | 445 | if($id){ |
445 | - if(php_sapi_name()=='cli'){ | ||
446 | - go(function ($id,$header,$data){ | ||
447 | - new syncMail($id,$header,$data); | ||
448 | - }, | ||
449 | - ...[$id,$header,$data] | ||
450 | - ); | ||
451 | - } | 446 | + Event::call(SyncMail::class,$id,$data); |
452 | } | 447 | } |
453 | 448 | ||
454 | }catch (\Throwable $e){ | 449 | }catch (\Throwable $e){ |
-
请 注册 或 登录 后发表评论