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..
<?php
//change this to your email.
$to = "m@yourdomain.com";
$from = "m2@yourdomain.com";
$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 Mohammed!</font> <br>
<a href="http://www.maaking.com/">* maaking.com</a>
</center>
<br><br>*** Now you Can send HTML Email <br> Regards<br>MOhammed Ahmed - Palestine
</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: [email]maa@p-i-s.cXom[/email]";
//$headers .= "Bcc: [email]email@maaking.cXom[/email]";
// now lets send the email.
mail($to, $subject, $message, $headers);
echo "Message has been sent....!"; ?>
The second code uses MIME
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..
<?php
//change this to your email.
$to = "m@yourdomain.com";
$from = "m2@yourdomain.com";
$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 Mohammed!</font> <br>
<a href="http://www.maaking.com/">* maaking.com</a>
</center>
<br><br>*** Now you Can send HTML Email <br> Regards<br>MOhammed Ahmed - Palestine
</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: [email]maa@p-i-s.cXom[/email]";
//$headers .= "Bcc: [email]email@maaking.cXom[/email]";
// now lets send the email.
mail($to, $subject, $message, $headers);
echo "Message has been sent....!"; ?>
The second code uses MIME
<?
//change this to your email.
$to = "m@yourdomain.com";
$from = "m2@yourdomain.com";
$subject = "Hello! This is HTML email";
//begin of HTML message
$message = "<html>
<body bgcolor=\"#DCEEFC\">
<center>
<b>Looool!!! I am reciving HTML email......</b> <br>
<font color=\"red\">Thanks Mohammed!</font> <br>
<a href=\"http://www.maaking.com/\">* maaking.com</a>
</center>
<br><br>*** Now you Can send HTML Email <br> Regards<br>MOhammed Ahmed - Palestine
</body>
</html>";
//end of message
// To send the HTML mail we need to set the Content-type header.
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";
$headers .= "From: $from\r\n";
//options to send to cc+bcc
//$headers .= "Cc: [email]maa@p-i-s.cXom[/email]";
//$headers .= "Bcc: [email]email@maaking.cXom[/email]";
// now lets send the email.
mail($to, $subject, $message, $headers);
echo "Message has been sent....!"; ?>
//change this to your email.
$to = "m@yourdomain.com";
$from = "m2@yourdomain.com";
$subject = "Hello! This is HTML email";
//begin of HTML message
$message = "<html>
<body bgcolor=\"#DCEEFC\">
<center>
<b>Looool!!! I am reciving HTML email......</b> <br>
<font color=\"red\">Thanks Mohammed!</font> <br>
<a href=\"http://www.maaking.com/\">* maaking.com</a>
</center>
<br><br>*** Now you Can send HTML Email <br> Regards<br>MOhammed Ahmed - Palestine
</body>
</html>";
//end of message
// To send the HTML mail we need to set the Content-type header.
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";
$headers .= "From: $from\r\n";
//options to send to cc+bcc
//$headers .= "Cc: [email]maa@p-i-s.cXom[/email]";
//$headers .= "Bcc: [email]email@maaking.cXom[/email]";
// now lets send the email.
mail($to, $subject, $message, $headers);
echo "Message has been sent....!"; ?>
Really good one keepit up
ReplyDeleteReally good one keepit up
ReplyDeleteWhen the Internet first started, email programs could only handle text messages. Plus, the access to the Internet was so slow that downloading a HTML email newsletter was unacceptable for most recipients due to extra time and fees.
ReplyDeleteHTML email software
This is possible just using simple html tag with no images and no div tags. You have to used only inline css and table tag for designing email newsletter.
ReplyDeleteWhen you using images then it goes to spam.