I have a problem in sending mail in HTML format using PHP mail() function. The problem is that the HTML is not rendered in microsoft outlook (showing raw data) but in yahoo it is good and the HTML is rendered and shown correctly. These are the mail agent I have checked the mail so far. I have used the following code which is basically taken from PHP manual.
<?php $to = 'email@example.com'; $subject = 'some subject'; $message = 'some HTML code such as a big table'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: sender <firstname.lastname@example.org>' . "\r\n"; mail($to, $subject, $message, $headers); ?>
Can any one say where the problem is and can provide a solution such that is works in all mail agent.