Mail() suddenly sends html as attachments!
Posted: Sun Sep 19, 2010 3:19 pm
Hi,
I have a problem with mail function in php. I use it in such method:
function send_mail_html($rec, $subject, $body, $replyto)
{
if($replyto=="")
$replyto = load_variable('owner_email');
$result=mail($rec, $subject, $body,
"From: ".load_variable('owner_email')."\r\n"
."Reply-To: ".$replyto."\r\n"
."Return-Path: ".load_variable('owner_email')."\r\n"
."Content-Type: text/html\r\n"
."X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)");
}
this method has not changed in last 6 months and emails were sent fine with it, but suddenly yesterday the client can't receive html emailm normally - html content is received as an attachement by MS Outlook 2007. I must add that MS Outlook had some updates installed recently which most pobably cause that problem. Hosting staff told me that problem might be with header and "\r\n" line breaks, but I read in manual that it is made correctly.
I have to ask what can be wrong with my method? Does it miss something or is there anything obvously wrong? Is it possible that long html lines in message body cause it (over 70 chars)? or \r\n line endings instead of \n?
BTW I don't know what X-Mailer is for and why it is set to MS Outlook, I saw also PHP+phpversion() instead but I don't know the purpose of it as this script isn't my.
Any help will be appreciated!
I have a problem with mail function in php. I use it in such method:
function send_mail_html($rec, $subject, $body, $replyto)
{
if($replyto=="")
$replyto = load_variable('owner_email');
$result=mail($rec, $subject, $body,
"From: ".load_variable('owner_email')."\r\n"
."Reply-To: ".$replyto."\r\n"
."Return-Path: ".load_variable('owner_email')."\r\n"
."Content-Type: text/html\r\n"
."X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)");
}
this method has not changed in last 6 months and emails were sent fine with it, but suddenly yesterday the client can't receive html emailm normally - html content is received as an attachement by MS Outlook 2007. I must add that MS Outlook had some updates installed recently which most pobably cause that problem. Hosting staff told me that problem might be with header and "\r\n" line breaks, but I read in manual that it is made correctly.
I have to ask what can be wrong with my method? Does it miss something or is there anything obvously wrong? Is it possible that long html lines in message body cause it (over 70 chars)? or \r\n line endings instead of \n?
BTW I don't know what X-Mailer is for and why it is set to MS Outlook, I saw also PHP+phpversion() instead but I don't know the purpose of it as this script isn't my.
Any help will be appreciated!