Posted by Big Moxy on 10/01/07 04:16
Here is my code for formatting an HTML email. I know that spinning
through the $_POST array as I am isn't very pretty but it's a long
list so for now I'm using this approach. The problem is that despite
setting the Content-type the resulting email arrives in plain text.
Outlook 2003 is my email client and I receive HTML emails without a
problem.
Can someone please advise me on what I'm doing wrong?
$to_address = "to@mysite.com";
$from_address = "webmail@mysite.com";
$subject = "Evaluation Request";
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.= "From: $from_address\r\n";
$message = "";
foreach ( $_POST as $key => $value ) {
$message.= "<b>" . $key . "</b>" . " " . ":" . " " . $value . "<br /
>";
};
$_SESSION['sent_message'] = "Thank you for your request! Someone will
be contacting you soon.";
mail($to_address, $subject, $message, $headers);
header = ("location: index.php");
Thank you!
- Tim
Navigation:
[Reply to this message]
|