示例:
email 1 has email to reply to as `test@testing.co.uk`
email 2 has email to reply to as `support@testing.co.uk`
我目前的代码:
if($this->teacherEmail && $this->teacher_reply_enable)
$this->mail->AddReplyTo($this->teacherEmail, $this->schoolTitle);
else
$this->mail->AddReplyTo($this->schoolEmail, $this->schoolTitle);
$this->mail->Subject = $this->subject;
$this->mail->msgHTML($this->getMessage());
$this->mail->AltBody = strip_tags($this->message);
$this->mail->addAddress($this->to, $this->to_name);
foreach($this->attachments as $item){
$email_attachment = DOC_ROOT.$item->path.$item->orig;
$email_attachment_title = $item->name;
$this->mail->addAttachment($email_attachment,$email_attachment_title);
}
if (!$this->mail->send()) {
return false;
} else {
return true;
}
我遇到的问题是电子邮件1已成功发送,reply-to:
是test@testing.co.uk,然后发送电子邮件2,reply-to:
都是{{1} }和test@testing.co.uk
。
我希望它为每封发送的电子邮件重置support@testing.co.uk
,以便它不会出现两个reply-to:
的问题
答案 0 :(得分:3)
根据文档,有一种名为clearReplyTos的方法。您可以尝试首先调用它,如下所示:
$this->mail->clearReplyTos();
if($this->teacherEmail && $this->teacher_reply_enable)
$this->mail->AddReplyTo($this->teacherEmail, $this->schoolTitle);
else
$this->mail->AddReplyTo($this->schoolEmail, $this->schoolTitle);
我自己没有使用它,只是快速浏览一下文档页面。