You are here: Need help with sending HTML formatted emails « PHP Programming Language « IT news, forums, messages
Need help with sending HTML formatted emails

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация