作者 邓超

超迹配置的自动回复

... ... @@ -138,14 +138,27 @@ class fob_ai_mail_auto_reply {
// 配置
$replySetting = $this->getAutoReplySetting($postid,$email['email']);
if($replySetting){
// 有配置才回复
$ret = \Lib\Mail\MailFun::sendEmail([
'subject' => 'Re:'.$data['subject'],
'tos' => [['email'=>$data['from'],'name'=>explode('@',$data['from'])[0]]],
'body' => $this->trimBody($data,$replySetting['content'],$body)
],$email);
_echo('回复成功'.$data['id'].'==='.$postid);
$this->log([$data,$replySetting,$ret]); // 立即写入日志
$isnext = true;
if($replySetting['reply_num']??0){
$nk = 'fobaimailautoreplynum:'.$postid.':'.md5($data['from']);
if(redis()->get($nk,0) > $replySetting['reply_num']){
$isnext = false;
}else{
redis()->incr($nk);
}
}
if($isnext){
// 有配置才回复
$ret = \Lib\Mail\MailFun::sendEmail([
'subject' => 'Re:'.$data['subject'],
'tos' => [['email'=>$data['from'],'name'=>explode('@',$data['from'])[0]]],
'body' => $this->trimBody($data,$replySetting['content'],$body)
],$email);
_echo('回复成功'.$data['id'].'==='.$postid);
$this->log([$data,$replySetting,$ret]); // 立即写入日志
}
}else{
_echo('没有找到配置'.$data['id'].'==='.$postid);
}
... ...