作者 邓超

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

@@ -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,6 +107,7 @@ class fob_ai_mail_auto_reply { @@ -107,6 +107,7 @@ 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 + if($mailInstance->login()){
110 $msg = $mailInstance->folder($folder['origin_folder'])->msg()->uid($data['uid']); 111 $msg = $mailInstance->folder($folder['origin_folder'])->msg()->uid($data['uid']);
111 if(!$msg->move('INBOX')){ 112 if(!$msg->move('INBOX')){
112 if(!$msg->copy('INBOX')){ 113 if(!$msg->copy('INBOX')){
@@ -120,6 +121,7 @@ class fob_ai_mail_auto_reply { @@ -120,6 +121,7 @@ class fob_ai_mail_auto_reply {
120 } 121 }
121 $mailInstance = null; 122 $mailInstance = null;
122 } 123 }
  124 + }
123 125
124 continue; 126 continue;
125 } 127 }