正在显示
1 个修改的文件
包含
13 行增加
和
11 行删除
@@ -92,7 +92,7 @@ class fob_ai_mail_auto_reply { | @@ -92,7 +92,7 @@ class fob_ai_mail_auto_reply { | ||
92 | 92 | ||
93 | 93 | ||
94 | // 检查是否是垃圾箱 | 94 | // 检查是否是垃圾箱 |
95 | - $folder = $this->db->cache(3600)->first(folderSql::first($data['folder_id'])); | 95 | + $folder = $this->db->throw()->cache(3600)->first(folderSql::first($data['folder_id'])); |
96 | if($folder['folder'] == '垃圾箱'){ | 96 | if($folder['folder'] == '垃圾箱'){ |
97 | $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 | 98 | ||
@@ -107,18 +107,20 @@ class fob_ai_mail_auto_reply { | @@ -107,18 +107,20 @@ class fob_ai_mail_auto_reply { | ||
107 | $email['password'] = base64_decode($email['password']); | 107 | $email['password'] = base64_decode($email['password']); |
108 | $email['host'] = $email['imap']; | 108 | $email['host'] = $email['imap']; |
109 | $mailInstance = \Lib\Imap\ImapPool::get((new \Lib\Imap\ImapConfig($email))); | 109 | $mailInstance = \Lib\Imap\ImapPool::get((new \Lib\Imap\ImapConfig($email))); |
110 | - $msg = $mailInstance->folder($folder['origin_folder'])->msg()->uid($data['uid']); | ||
111 | - if(!$msg->move('INBOX')){ | ||
112 | - if(!$msg->copy('INBOX')){ | ||
113 | - @file_put_contents(__DIR__."/move_log.log",'移动邮件失败'.json_encode($data,JSON_UNESCAPED_UNICODE)."\n",FILE_APPEND); | ||
114 | - $ok = false; | ||
115 | - _echo("垃圾邮件移动失败 ".$data['id'].' '.$data['subject']); | 110 | + if($mailInstance->login()){ |
111 | + $msg = $mailInstance->folder($folder['origin_folder'])->msg()->uid($data['uid']); | ||
112 | + if(!$msg->move('INBOX')){ | ||
113 | + if(!$msg->copy('INBOX')){ | ||
114 | + @file_put_contents(__DIR__."/move_log.log",'移动邮件失败'.json_encode($data,JSON_UNESCAPED_UNICODE)."\n",FILE_APPEND); | ||
115 | + $ok = false; | ||
116 | + _echo("垃圾邮件移动失败 ".$data['id'].' '.$data['subject']); | ||
117 | + } | ||
116 | } | 118 | } |
119 | + if($ok) { | ||
120 | + _echo("垃圾邮件移动成功 ".$data['id'].' '.$data['subject']); | ||
121 | + } | ||
122 | + $mailInstance = null; | ||
117 | } | 123 | } |
118 | - if($ok) { | ||
119 | - _echo("垃圾邮件移动成功 ".$data['id'].' '.$data['subject']); | ||
120 | - } | ||
121 | - $mailInstance = null; | ||
122 | } | 124 | } |
123 | 125 | ||
124 | continue; | 126 | continue; |
-
请 注册 或 登录 后发表评论