Php set return email

When using PHP to send emails, how can I set a return path for receiving returned emails?

+3
source share
2 answers

There mail()is a parameter that allows the user to set additional headers. You must set the "Return-Path" header, for example:

mail($email, $subject, $message,
"From: $returnaddress\n"
. "Reply-To: $returnaddress\n"
. "Return-Path: $returnaddress);
+4
source

To make this work on my server (bluehost), I also had to use the fifth parameter (for example, "$ Additional"), as shown below:

     $headers = "From: joe.smith@shaw.ca\r\nReply-To: joe.smith@shaw.ca";

     $additional = "-rjoe.smith@shaw.ca";

     mail("fred.jones@shaw.ca", "Subject", "Message",$headers, $additional); 
+3
source

Source: https://habr.com/ru/post/1716660/


All Articles