November 6, 2008

The missing 5th parameter for PHP Mail()

So happy!!! Finally I solved my php email script problem for sending emails to server with SPF record!!!

There is a missing 5th parameter for PHP Mail() which I never know (eventhough on php.net mail() function did show up 5th parameter).

My problems is no matter on which site I setup mail scripts, the Return-path always showing the main server url which most of the time causing problem for sending email to some protected email server. No matter how I set the headers to include Reurn-path to any email address, it will never show up the correct one. At last now I have the solution,

mail($to, $subject, $bodymessage, $headers, "[email protected]")

[email protected] is the address I sepcified, there must be a -f in front of the address.

Hope this will be helpful 😉

Leave a Reply

iosc.net 1994-2023