PDA

View Full Version : php: simple code to send HTML email



admans
07-17-2005, 07:03 AM
good day,

this simple code lines will help you sending html email.
of course you can enhance for your need eg. using form, using it in newsletter etc.
but outcoming emails might reported as spam ... so when you test don't forget to check you bulk/junk mail lol..




<?
//change this to your email.
$to = "a@cashfest.info";
$from = "ad@cashfest.info";
$subject = "Hello! This is HTML email";

//begin of HTML message
$message = <<<EOF
<html>
<body bgcolor="#DCEEFC">
<center>
<b>Looool!!! I am reciving HTML email......</b> <br>
<font color="red">Thanks Admans!</font> <br>
<a href="http://www.cashfest.info/">* cashfest.info</a>
</center>
<br><br>*** Now you Can send HTML Email <br> Regards<br>Admans
</body>
</html>
EOF;
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";

//options to send to cc+bcc
//$headers .= "Cc: maa@p-i-s.cXom";
//$headers .= "Bcc: email@cashfest.cXom";

// now lets send the email.
mail($to, $subject, $message, $headers);

echo "Message has been sent....!";
?>