Reputation: 1520
How can I set the Return-path in phpmailer? I have this:
$mail = new PHPmailer();
$mail->IsHTML(true);
$mail->SetFrom($_SESSION['user_mail'], $_SESSION['user_name']);
$mail->AddAddress($leverancier_mail, $leverancier_mail);
$mail->AddBCC($config['kopie_mail'], $config['kopie_mail']);
$mail->AddReplyTo($_SESSION['user_mail'], $_SESSION['user_name']);
$mail->Sender = $_SESSION['user_mail'];
When an mail is returned it is send to the administrator instead of the sender. How can I make it return to the sender?
Upvotes: 2
Views: 2910
Reputation: 464
PHPMailer class sets Return-path automatically to From or Sender:
public function CreateHeader() {
...
if(empty($this->Sender)) {
$result .= $this->HeaderLine('Return-Path', trim($this->From));
} else {
$result .= $this->HeaderLine('Return-Path', trim($this->Sender));
}
...
}
Upvotes: 2