Is it possible to change the Return-Path value in emails are sending via mail() function of PHP ?
It's value is '[email protected]' in emails I send in my site and it causes some problems on email delivery failed process. I want to set it to my email address.
Here's the code I have tried:
$headers = 'MIME-Version: 1.0' . "\n"; $headers .= "Content-type: text/html; charset=utf-8" . "\n"; $headers .= "Return-Path: <[email protected]>"."\n"; $headers .= "Errors-To: <[email protected]>"."\n"; // Additional headers $headers .= "To: [email protected] <[email protected]>" . "\n"; $headers .= "From: [email protected] <[email protected]>"; // Mail it mail('[email protected]', 'test', 'salam', $headers, "f");
Changing the Return-Path Header on Your Training EmailsClick your email address on the top-right of the screen, then click Account Settings. Navigate to the Training Settings section. Under the Training Email Headers subsection, click the checkbox next to Overwrite Fixed Return-path Address with Sender Address.
Return Value: Returns the hash value of the address parameter, or FALSE on failure. Note: Keep in mind that even if the email was accepted for delivery, it does NOT mean the email is actually sent and received!
The return-path is used to process bounces from your emails and is set in the email header. It defines how and where bounced emails will be processed. The return-path can also be referred to as a bounce address or a reverse path, and is an SMTP address that is separate from your sending address.
PHP mail() function is used to send email in PHP. You can send text message, html message and attachment with message using PHP mail() function.
You can set reply to & return path into headers as below
$headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'Return-Path: [email protected]'
OR as the fifth parameter to adjust the return path
mail($to, $subject, $message, $headers, "-f [email protected]");
where [email protected] should be replaced by your mail.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With