作者 邓超

自动回复 把邮件从垃圾箱移到收件箱

@@ -101,6 +101,7 @@ class fob_ai_mail_auto_reply { @@ -101,6 +101,7 @@ class fob_ai_mail_auto_reply {
101 // 配置 101 // 配置
102 $replySetting = $this->getAutoReplySettingJunk($postid,$email['email']); 102 $replySetting = $this->getAutoReplySettingJunk($postid,$email['email']);
103 if($replySetting){ 103 if($replySetting){
  104 + $ok = true;
104 $email['password'] = base64_decode($email['password']); 105 $email['password'] = base64_decode($email['password']);
105 $email['host'] = $email['imap']; 106 $email['host'] = $email['imap'];
106 $mailInstance = \Lib\Imap\ImapPool::get((new \Lib\Imap\ImapConfig($email))); 107 $mailInstance = \Lib\Imap\ImapPool::get((new \Lib\Imap\ImapConfig($email)));
@@ -108,8 +109,11 @@ class fob_ai_mail_auto_reply { @@ -108,8 +109,11 @@ class fob_ai_mail_auto_reply {
108 if(!$msg->move('INBOX')){ 109 if(!$msg->move('INBOX')){
109 if(!$msg->copy('INBOX')){ 110 if(!$msg->copy('INBOX')){
110 @file_put_contents(__DIR__."/move_log.log",'移动邮件失败'.json_encode($data,JSON_UNESCAPED_UNICODE)."\n",FILE_APPEND); 111 @file_put_contents(__DIR__."/move_log.log",'移动邮件失败'.json_encode($data,JSON_UNESCAPED_UNICODE)."\n",FILE_APPEND);
  112 + $ok = false;
  113 + _echo("垃圾邮件移动失败 ".$data['id'].' '.$data['subject']);
111 } 114 }
112 } 115 }
  116 + if($ok) _echo("垃圾邮件移动成功 ".$data['id'].' '.$data['subject']);
113 $mailInstance = null; 117 $mailInstance = null;
114 } 118 }
115 119