\r\n issues with html mail
Posted: Thu Oct 06, 2011 9:42 am
Can anyone tell me why my code still sends me \r\n in my html emails or point me to a reference in how to format my code properly so that I don't get horrible emails.
Code: Select all
$message = "
<html>
<head>
<title>Faithbook Communication</title>
<style>
#body{ background-color:#efefef; font:12px Arial, Helvetica, sans-serif; color:#003366; }
.heading{ margin: 0em 0em 1em 0; width:400px; font:bold arial, helvetica; }
#message{ margin: 3em 3em 3em 0; width:400px background-color:#fff; }
.headers{ color:#336699; margin:-.3em 0 0 0; font:11px; }
#footer{ background-image:url(http://www.lfmi.org/image/blue1_no_background.png); background-repeat:no-repeat; font:11px Arial, Helvetica, sans-serif;
color:#333; text-align:right; width:100%; height:100px; margin: 1em 0 0 1em; }
h1{ font: bold 16px Arial, Helvetica, sans-serif; color:#003366; margin: 0 0 14px; }
</style>
</head>
<body id='body'>
<h1>Living Faith Training Center</h1>
<p class='heading'>" . stripslashes($subject) . "</p>
<p class='headers'>To:" . $name . "</p>
<p class='headers'>From: " . $sender . "<br />
<p id='message'>" .nl2br($_POST['myReply']) . "</p> ///I HAVE TRIED EVERYTHING HERE STR_REPLACE included
<div id='footer' </div>;
</body>
</html>";
//To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
//Additional headers
$headers .= 'To: <' . $to . '>' . "\r\n";
$headers .= 'From: ' . $sender . ' <email@lfmi.org>' . "\r\n";