kratak Posted July 18, 2006 Share Posted July 18, 2006 HiIm trying to use a script to send a html email to various people. If i send it to a hotmail user and open the email, the email does appear correct, processing the html code. However if you access the same email via Outlook (2003) it comes out showing the code rather than interpreting it.Ive tried several websites and the they all talk about the headers. I have tried several different bits of code in the headers, all have had no effect. Any advice welcome.Here is my code[code]<?php $email = array('[email protected]', '[email protected]');foreach ($email as $k => $v) { $to = $v; $from = "[email protected]"; $subject = "subject";$headers = "From: [email protected]\n"; $headers .= "Message-ID: <" . md5(uniqid(time())) . "@mydomain.com>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Date: ".date("D, d M Y H:i:s") . " UT\n"; $headers .= "Reply-To: [email protected]\n"; $headers .= "Return-Path: [email protected]\n"; $headers .= "X-Priority: 3\r\nX-MSmail-Priority: Normal\n"; $headers .= "X-mailer: php/".phpversion()."\n"; $headers .= "X-MimeOLE: Produced By MyDomain\n"; $headers .= "Content-type: text/plain; charset=iso-8859-1\n"; $message = "<html><body><p><font color='red'>Hello</font></p></body></html>"; mail($to, $subject, $message,$headers); }?>[/code] Link to comment https://forums.phpfreaks.com/topic/14946-php-html-mail/ Share on other sites More sharing options...
Orio Posted July 18, 2006 Share Posted July 18, 2006 I think the problem is here:$headers .= "Content-type: text/plain; charset=iso-8859-1\n"; Instead of text/plain it should be something else (I dont know what, my guess will be "text/html" or something like that).Orio. Link to comment https://forums.phpfreaks.com/topic/14946-php-html-mail/#findComment-59972 Share on other sites More sharing options...
willfitch Posted July 18, 2006 Share Posted July 18, 2006 $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; Link to comment https://forums.phpfreaks.com/topic/14946-php-html-mail/#findComment-59973 Share on other sites More sharing options...
kratak Posted July 18, 2006 Author Share Posted July 18, 2006 thanks, that solved it Link to comment https://forums.phpfreaks.com/topic/14946-php-html-mail/#findComment-59983 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.