Example:
email 1 has email to reply to as `[email protected]`
email 2 has email to reply to as `[email protected]`
My current code:
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;
}
The problem i'm having is that email 1 has been sent successfully the reply-to:
is [email protected], then email 2 is sent and the reply-to:
is both [email protected]
and [email protected]
.
I want it to reset the reply-to:
for each email sent so that it doesn't have the issue of having two reply-to:
's
According to the documentation there is a method called clearReplyTos. You could try calling that first as below:
$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);
I haven't used it myself but just a quick skim of the doc pages brought that up.