...
|
...
|
@@ -89,10 +89,18 @@ class fob_ai_mail_auto_reply { |
|
|
// 不是屏蔽的
|
|
|
$body = getBodyHtml(getMailBody($data['id']));
|
|
|
if(isAiAutoMail($data['from'],$data['subject'],$body)===0){
|
|
|
|
|
|
|
|
|
// 检查是否是垃圾箱
|
|
|
$folder = $this->db->cache(3600)->value(folderSql::first($data['folder_id']));
|
|
|
if($folder['folder'] == '垃圾箱'){
|
|
|
$email = $this->db->throw()->cache(3600)->first(\Model\emailSql::first($data['email_id']));
|
|
|
|
|
|
// 检查 是否开启了自动回复
|
|
|
list($postid,$source) = $this->getPostid($data['email_id']);
|
|
|
// 配置
|
|
|
$replySetting = $this->getAutoReplySettingJunk($postid,$email['email']);
|
|
|
if($replySetting){
|
|
|
$email['password'] = base64_decode($email['password']);
|
|
|
$email['host'] = $email['imap'];
|
|
|
$mailInstance = \Lib\Imap\ImapPool::get((new \Lib\Imap\ImapConfig($email)));
|
...
|
...
|
@@ -103,6 +111,8 @@ class fob_ai_mail_auto_reply { |
|
|
}
|
|
|
}
|
|
|
$mailInstance = null;
|
|
|
}
|
|
|
|
|
|
continue;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -207,6 +217,27 @@ class fob_ai_mail_auto_reply { |
|
|
return false;
|
|
|
}
|
|
|
|
|
|
public function getAutoReplySettingJunk($postid,$email){
|
|
|
$sets = $this->fob_db->throw()->all("select * from `ai_mail_auto_reply_setting` where ".dbWhere([
|
|
|
'postid' => $postid
|
|
|
]));
|
|
|
if(!$sets){
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
foreach ($sets as $set){
|
|
|
$set['emails'] = @json_decode($set['emails'],true);
|
|
|
// 是否开启了
|
|
|
if($set['emails']&&(in_array($email,$set['emails'])||in_array('所有邮箱',$set['emails']))){
|
|
|
if($set['junk_to_inbox']){
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 项目id
|
...
|
...
|
|