I wrote an auto responder program that send an html email. I noticed that when I open an email it sent in my netzero email account it is formatted like it is supposed to. if I use a <p> tag it formats the paragraph or a <center> tag it centers the text, but the same email when it comes to my outlook express shows the html in the email and it is not formatted. I also noticed that it shows the headers in outlook express as well. How do I make thsi email show up the same in a web mail client such as netzero and in outlook express?
The email message that is sent is typed into a textarea box and stored in a mysql database. then it is automatically sent at a certain time by the auto responder.
Is there another way to format a message that is stored in a database tahn using HTML?
I also wrote an email newsletter program that send an HTML auto responce to people who join the newsletter. This program works like it is supposed to. As far as I know I did everything pretty much the same, but in the auto responder program the html shows up in the email message.
This is the code that sends the email in the auto responder program.
while ($row = @ mysql_fetch_array($result)){
// Get the web site email address
autoResponderQuery(&$connection, "queryCompanyInfoTable", $responderNum, $responderID, NULL, NULL);
$companyInfoResult = $_SESSION['result'];
unset($_SESSION['result']);
$companyInfoRow = @ mysql_fetch_array($companyInfoResult);
// Start by setting up the "to" address
$to = " <" . $row['email'] . ">";
// And, last (before we build the email), set up some mail headers
$headers = "From: <" . $emailFrom . ">\r\n";
$headers .= "Reply-To: <" . $companyInfoRow["company_email"] . ">\n";
$headers .= "X-Sender: <" . $row['email'] . ">\r\n";
$headers .= "Message-ID: " . date("r") . " " . $companyInfoRow["company_email"] ."\n";
$headers .= "Return-Path: <" . $companyInfoRow["company_email"] . ">\r\n";
$headers .= "X-Mailer: PHP Mailer 1.0\n";
$headers .= "Date: " . date("r") . "\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
$headers .= "MIME-Version: 1.0\n";
// Now, setup the "subject" line
$responderSubject = $autoResponderRow['responder_subject'];
$responderSubject = str_replace ("\"", "”", $responderSubject);
$responderSubject = str_replace ("\'", "'", $responderSubject);
$subject = $responderSubject;
// set up the message body
$responderMessage = $autoResponderRow['responder_message'];
$responderMessage = str_replace ("\"", "”", $responderMessage);
$responderMessage = str_replace ("\'", "'", $responderMessage);
//$responderMessage = str_replace ("\\n", "\n", $responderMessage);
// output the beginning of the html email
$out = '<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Volsch Enterprises Inc Real Estate Broker</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
}
-->
</head>
<body text="#000000" link="#000000" vlink="#00FFFF">
<table>
<tr>
<td><center><img src="http://' . $siteName . '/images/' . $graphicName . '" width="144" height="114"></center></td>
</tr>
<tr>
<td>';
$out .= $responderMessage;
$out .= '</td>
</tr>
</table>
</body>
</html>';
// call the mail function
mail($to, $subject, $out, $headers);
$responderSentIncrement = $row['last_responder_sent'] + 1;
$custID = $row['cust_id'];
DatabaseUpdate("lastResponderSent", &$connection, $custID, $responderSentIncrement);
}