Page 1 of 1

Php Mail Header problem with Microsoft Outlook

Posted: Thu Mar 06, 2008 7:26 am
by francisjeffy
Hi,

When I used a header, like the one below, for my Php Mail Function, it worked with all mail accounts like gmail, hotmail etc, but not with Microsoft Outlook.

Code: Select all

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' .$from."\r\n";
Theses Headers were the ones given in Php Manual. But After removing the '\r' from the header, It works well with all mails including Microsoft Outlook


The working header is like

Code: Select all

$headers  = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= 'From: ' .$from."\n";
I am not sure why it does not work with '\r', If you have come across a similar problem, please share your thoughts on it.

Kind Regards,

JeF

Re: Php Mail Header problem with Microsoft Outlook

Posted: Thu Mar 06, 2008 8:44 am
by Sekka
They answer this on the mail function page of the PHP docs.

http://uk.php.net/function.mail
Note: If messages are not received, try using a LF (\n) only. Some poor quality Unix mail transfer agents replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with » RFC 2822.