Forum Moderators: coopster
$headers = "From: info@mydomain.com\r\n";
$headers .= "Message-ID: <" . md5(uniqid(time())) . "@mydomain.com>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "Date: ".date("D, d M Y H:i:s") . " UT\r\n";
$headers .= "Reply-To: info@mydomain.com\r\n";
$headers .= "Return-Path: info@mydomain.com\r\n";
$headers .= "X-Priority: 3\r\nX-MSMail-Priority: Normal\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";
$headers .= "X-MimeOLE: Produced By MyDomain\r\n";
$success=mail($to, $s_subject, $s_emailmsg, $headers);
Only the "MIME-Version" and the three "X-..." hearders appear in the message body. The other weird thing is that this only happens in Outlook. The mail looks normal in Hotmail.
I had someone with a similar problem a while back and what they did was they moved the content-type header to parse last. Its a long shot, but give it a try:
$headers = "From: info@mydomain.com\r\n";
$headers .= "Message-ID: <" . md5(uniqid(time())) . "@mydomain.com>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Date: ".date("D, d M Y H:i:s") . " UT\r\n";
$headers .= "Reply-To: info@mydomain.com\r\n";
$headers .= "Return-Path: info@mydomain.com\r\n";
$headers .= "X-Priority: 3\r\nX-MSMail-Priority: Normal\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";
$headers .= "X-MimeOLE: Produced By MyDomain\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$success=mail($to, $s_subject, $s_emailmsg, $headers);
dc
I'm guessing there must be a switch or a setting in sendmail that is messing it up, but I have no idea what.
According to to phpinfo, I running sendmail with two flags
-i
-t
but they don't seem to be the problem.
Where else should I look?
What I discovered, after much testing, was that my PHP server didn't support the MIME type and couldn't actually send it with the mail () PHP function. Or that was what I was told.
The only solution I could find to my problem is to send the email through an SMTP connection.
Hope this helps.
$crlf = "\r\n";
$headers = 'MIME-Version: 1.0' . $crlf;
$headers .= "From: $from" . $crlf;
$headers .= 'Content-type: text/html; charset=iso-8859-1' . $crlf;
... etc.
sendmail I understand would change \r\n to \n while qmail does not seem to do that.
also another view...
From the php manual
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.
from [php.net...]
in essence what happens is than \r\n is sometimess becomes \r\r\n
Please see [bugs.php.net...] for some discussion on the issue