When sending emails from scripts, not setting proper from address can give two problems, once is email ending up in spam/junk box of recieving email server and second is that the return path would be user@server.hostname.com.

To avoid this and to setup return path using php mail() function you need to use the fifth parameter of php mail() function :

Reference : http://php.net/mail

bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )

You can see above that the parameter 4 and 5 are optional. Exim supports the 5th parameter and you should be able to setup the return path using format like below like this:

mail($email, $subject, $msg, $mailheaders, "-f$from_email");

Tags: , , , ,

Leave a Reply