Changing the Return-path using PHPMailer

Elitmiar picture Elitmiar · Aug 12, 2010 · Viewed 26.5k times · Source

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?

Answer

Elitmiar picture Elitmiar · Aug 13, 2010

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