mail(), html, & 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
aaroncampbell
Forum Newbie
Posts: 4
Joined: Thu Mar 04, 2004 11:50 am

mail(), html, & Outlook

Post 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?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

what version of outlook you using?


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

Mark
User avatar
werlop
Forum Commoner
Posts: 68
Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null

Post 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";

?>
aaroncampbell
Forum Newbie
Posts: 4
Joined: Thu Mar 04, 2004 11:50 am

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