With so many mail server or clients software out there. I found that the header has to be set up with the right orders, otherwise, some of them will not work.
Such as the headers like below
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: newsletter@domain.com' . "\r\n";
$headers .= 'To: listaddr@domain.com' . "\r\n";
The errors I run into is that
1) $headers = 'MIME-Version: 1.0' . "\r\n";
if this line is the first line as in the sample, sometimes, the email I received are without From: information, and html email is broken with html tags shown.
and 'MIME-Version: 1.0' . "\r\n"; cannot be the first line, and cannot be put before headers "From", it has to be put behind 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
Why?
2) if without 'MIME-Version: 1.0' . "\r\n"; my squirrelmail cannot read the html email, it will show tags.
So I have to put 'MIME-Version: 1.0' . "\r\n"; in the headers, and it has to be behind the header of content type. This seems satisfy all the situations. But at the same time, I got the MIME-Version: 1.0 shows in the message body part when I download the email to my desk top and read it with outlook express.
Could anyone give a headers sample in the right order with only very necessary headers for html email?
Thanks!