正在显示
1 个修改的文件
包含
31 行增加
和
0 行删除
@@ -89,10 +89,18 @@ class fob_ai_mail_auto_reply { | @@ -89,10 +89,18 @@ class fob_ai_mail_auto_reply { | ||
89 | // 不是屏蔽的 | 89 | // 不是屏蔽的 |
90 | $body = getBodyHtml(getMailBody($data['id'])); | 90 | $body = getBodyHtml(getMailBody($data['id'])); |
91 | if(isAiAutoMail($data['from'],$data['subject'],$body)===0){ | 91 | if(isAiAutoMail($data['from'],$data['subject'],$body)===0){ |
92 | + | ||
93 | + | ||
92 | // 检查是否是垃圾箱 | 94 | // 检查是否是垃圾箱 |
93 | $folder = $this->db->cache(3600)->value(folderSql::first($data['folder_id'])); | 95 | $folder = $this->db->cache(3600)->value(folderSql::first($data['folder_id'])); |
94 | if($folder['folder'] == '垃圾箱'){ | 96 | if($folder['folder'] == '垃圾箱'){ |
95 | $email = $this->db->throw()->cache(3600)->first(\Model\emailSql::first($data['email_id'])); | 97 | $email = $this->db->throw()->cache(3600)->first(\Model\emailSql::first($data['email_id'])); |
98 | + | ||
99 | + // 检查 是否开启了自动回复 | ||
100 | + list($postid,$source) = $this->getPostid($data['email_id']); | ||
101 | + // 配置 | ||
102 | + $replySetting = $this->getAutoReplySettingJunk($postid,$email['email']); | ||
103 | + if($replySetting){ | ||
96 | $email['password'] = base64_decode($email['password']); | 104 | $email['password'] = base64_decode($email['password']); |
97 | $email['host'] = $email['imap']; | 105 | $email['host'] = $email['imap']; |
98 | $mailInstance = \Lib\Imap\ImapPool::get((new \Lib\Imap\ImapConfig($email))); | 106 | $mailInstance = \Lib\Imap\ImapPool::get((new \Lib\Imap\ImapConfig($email))); |
@@ -103,6 +111,8 @@ class fob_ai_mail_auto_reply { | @@ -103,6 +111,8 @@ class fob_ai_mail_auto_reply { | ||
103 | } | 111 | } |
104 | } | 112 | } |
105 | $mailInstance = null; | 113 | $mailInstance = null; |
114 | + } | ||
115 | + | ||
106 | continue; | 116 | continue; |
107 | } | 117 | } |
108 | 118 | ||
@@ -207,6 +217,27 @@ class fob_ai_mail_auto_reply { | @@ -207,6 +217,27 @@ class fob_ai_mail_auto_reply { | ||
207 | return false; | 217 | return false; |
208 | } | 218 | } |
209 | 219 | ||
220 | + public function getAutoReplySettingJunk($postid,$email){ | ||
221 | + $sets = $this->fob_db->throw()->all("select * from `ai_mail_auto_reply_setting` where ".dbWhere([ | ||
222 | + 'postid' => $postid | ||
223 | + ])); | ||
224 | + if(!$sets){ | ||
225 | + return false; | ||
226 | + } | ||
227 | + | ||
228 | + foreach ($sets as $set){ | ||
229 | + $set['emails'] = @json_decode($set['emails'],true); | ||
230 | + // 是否开启了 | ||
231 | + if($set['emails']&&(in_array($email,$set['emails'])||in_array('所有邮箱',$set['emails']))){ | ||
232 | + if($set['junk_to_inbox']){ | ||
233 | + return true; | ||
234 | + } | ||
235 | + } | ||
236 | + } | ||
237 | + | ||
238 | + return false; | ||
239 | + } | ||
240 | + | ||
210 | 241 | ||
211 | /** | 242 | /** |
212 | * 项目id | 243 | * 项目id |
-
请 注册 或 登录 后发表评论