The following headers are sent using PHP's mail() function:
$emailheaders = "From: " . $sender . "\n";
$emailheaders .= "Return-Path: " . $sender . "\n";
$emailheaders .= "MIME-Version: 1.0\n";
$emailheaders .= "Content-type: text/html; charset=UTF-8\r\n";
mail($email, $subject, $body, $emailheaders);
It works fine, except Return-Path: is reset to [email protected], or at least this is what shows up when viewing extended headers for emails received using the above headers. Naturally this means that bounce emails are not received.
Does Apache reset the headers, and in this case why, or am I using mail() incorrectly?
What can I do to prevent this from happening. Using mail()'s fifth parameter (e.g. -f [email protected]) is out of the question as PHP is in safe mode and the provider will not change that. I suppose that there isn't some way to allow the fifth parameter for certain users despite safe mode being on.
The server is running Apache 2.2.3 and PHP version 5.1.6.
You are splitting the headers using
\nbut according to PHP it should be \r\n (see Which line break in php mail header, \r\n or \n?).Perhaps thats the reason why the header isnt send correctly.