by webmaster on Thu Jul 21, 2005 9:16 am
The only thing that makes an email to be shown as HTML is something called header information. when you send the email, you first declare what kind of document you're sending. Here's an example of a HTML e-mail:
[php]<?php
$to = "johndoe@fakedomain.com";
$from = "janedoe@anotherfakedomain.com";
$subject = "This is a test email";
$message = <<<EOF
<html>
<body bgcolor="#ffffff">
<p align="center">
<b>Hello World!</b>
</p>
</body>
</html>
EOF;
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($to, $subject, $message, $headers);
if ($success)
echo "The email to $to from $from was successfully sent";
else
echo "An error occurred when sending the email to $to from $from";
?> [/php]