Page 1 of 1

mail(), html, & Outlook

Posted: Thu Mar 04, 2004 11:50 am
by aaroncampbell
Well, I see that a while ago people had the same problems as me (http://www.phpbuilder.com/board/sho...readid=10240258), but I see no answers anywhere, so here goes:

I am sending E-Mail from a form on my website using the php mail(). The problem is that when I send it as html, outlook has problems. Here are the headers I'm using:

Code: Select all

$headers  = "From: $name <$email>\r\n"; 
$headers .= "Reply-To: $email \r\n"; 
$headers .= "MIME-Version: 1.0\r\n"; 
$headers .= "Content-type: text/html;";
When I do this, the E-Mail looks fine in squirrelmail (a webmail program http://www.squirrelmail.org), but in outlook...instead of getting a nicely formatted html message, I get a message that starts with "Content-type: text/html;" then continues on in plaintext, showing me all the html tags, etc. I tried switching some of the headers around, and if I switch the mime & content-type headers, I see html in BOTH E-Mail programs, but outlook starts the message off with "MIME-Version: 1.0" which I suppose is the lesser of 2 evils, but there is no reason that I should have to see that. Does anyone have a solution?

Posted: Thu Mar 04, 2004 12:46 pm
by JayBird
what version of outlook you using?


It varies with different versions. I think Outlook 2000 has this problem.

Mark

Posted: Thu Mar 04, 2004 12:47 pm
by werlop
I had to fiddle around to get mail working in HTML in outlook for a while. Eventually I got it working, with the only headers I use being:

Code: Select all

<?php

$header = "From: whoever <" . SITE_EMAIL . ">\n";
$header .= "Content-type: text/html; charset=iso-8859-1\r\n";

?>

Posted: Thu Mar 04, 2004 1:03 pm
by aaroncampbell
Bech100 wrote:what version of outlook you using?
Microstoft Office Outlook 2003 (11.5608.5703)


werlop...sorry, you're right...that works for outlook, but then it doesn't work for anything else (ie squirrel mail). I need to make it so people can check this E-Mail via outlook (our in-office E-Mail program) or squirrel mail (our webmail program). In order for it to work in other programs, like squirrelmail, it has to have the MIME header in there