Search code examples
phpphpmailer

Changing the Return-path using PHPMailer


Is there a way to change the return-path using PHPMailer

I did the following and it did not work

$mail->AddCustomHeader('Return-path:[email protected]');

I'm using the following statement to send mails

if(!$mail->Send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;

    } else {
        //Building the reporting email to report on all the mails send 
        echo "Message REPORT sent!\n";
    }

I get the email but the return path does not change?


Solution

  • The following solved the issue, I adjusted the Sender property and it worked for me. $mail->Sender = '[email protected]';