I'm trying to import the contents of an HTML newsletter into a PHP script and mail it out, but it's not working correctly. I know the html file is importing correctly because I can see it when I display the contents of $body (see below). However, when I pass $body to PHP's mail() I don't recieve the message. If I use htmlspecialchars() on $body before mailing I recieve the message with the proper (unrendered) html code. And if I use addslashes() I recieve a message with the tables and text but hardly any proper formatting. PHP's mail() seems to be choking on some special characters. etc. in the html file but I can't figure out how to deal with it. The code I'm testing with is below. Can anyone help?
Thanks
<?
$to="David Rock<test@frii.com>";
$headers ="From: admin@frii.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$subject ="HTML Newsletter test";
// read the html contents into $body
ob_start();
include ("$body = ob_get_contents();
ob_end_clean();
// $body = htmlspecialchars($body);
// $body = addslashes("$body"
;
// print ("$body"
;
mail($to, $subject, $body, $headers);
?>
Thanks
<?
$to="David Rock<test@frii.com>";
$headers ="From: admin@frii.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$subject ="HTML Newsletter test";
// read the html contents into $body
ob_start();
include ("$body = ob_get_contents();
ob_end_clean();
// $body = htmlspecialchars($body);
// $body = addslashes("$body"

// print ("$body"

mail($to, $subject, $body, $headers);
?>