Php Mail Header problem with Microsoft Outlook

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
francisjeffy
Forum Newbie
Posts: 17
Joined: Fri Feb 29, 2008 12:10 pm

Php Mail Header problem with Microsoft Outlook

Post 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
User avatar
Sekka
Forum Commoner
Posts: 91
Joined: Mon Feb 18, 2008 10:25 am
Location: Huddersfield, West Yorkshire, UK

Re: Php Mail Header problem with Microsoft Outlook

Post 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.
Post Reply