HTML mail doesn’t show in Microsoft Outlook
Posted by jhalak on July 25, 2008
I have sent HTML mail with PHP but it shows in evolution / thunderbird in Linux but not in Outlook Express in Windows. To solve the problem use the following code:
$boundary = “_e5YKJHKJHKH098090871893712893″;
$message = “–$boundary\n”;
$message .= “Content-disposition: inline\n”;
$message .= “Content-type: text/html\n\n”;
$message .= “<html>\n”;
$message .= “<head>\n”;
$message .= “<title>Your title</title>\n”;
$message .= “</head>\n”;
$message .= “<body>\n”;
$message .= “\n”;
$message .= “<TABLE width=600 border=0 cellpadding=4 cellspacing=1 bgcolor=#878676>\n”;
$message .= “ <TR>\n”;
$message .= “ <TD bgcolor=white nowrap>Your text</TD>\n”;
$message .= “ </tr>\n”;
$message .= “</TABLE>\n”;
$message .= “</body>\n”;
$message .= “</html>\n”;
$message .= “\n–$boundary–\n”;
$headers = ‘From:’ .$author. “\r\n” . ‘Reply-To:’ .$author;
$headers .= “\nContent-type: multipart/alternative; boundary=\”$boundary\”\nMime-Version: 1.0″;
if (mail($mailto, $subject , $message, $headers)) echo “Mail sent successfully”;
else echo “Something problem !!!!!!!!!!!!!!!!”;
Tommy said
What part of this was the solution?
jhalak said
Sorry. I should make it clear.
Actually this should be at the first and at the last part of the message.
Thanks for your comment Tommy.