Facebook Twitter Reset

This Tutorial Has Been Viewed 1,918 Times.

HTML E-mail Using PHP

There are two varieties of email. Text and HTML. Text email is like regular text messages. HTML email is like viewing a webpage with colors and images. To create the effect of an HTML email, a couple of extra headers must be added.

$to = "admin@mistonline.in";
$subject = "My HTML email test.";
$headers = "From: myplace@here.com;\r\n";
$headers .= "Reply-To: myplace2@mistonline.in;\r\n";
$headers .= "Return-Path: myplace@mistonline.in;\r\n";
$headers .= "MIME-Version: 1.0;\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message .= "<h1> This is a test </h1>";
$message .= "";

if ( mail($to,$subject,$message,$headers) ) {
echo "The email has been sent!";
} else {
echo "The email has failed!";
}

MIME stands for Multipurpose Internet Mail Extensions. It is a set of instructions that allows emails to be sent in more than just plain text.

Content-Type sets what type of data is goign to be sent. The default value would be “text/plain”.

Charset is character set. Each language or set of characters has its own title or name. This value lets the recipient email know which one is used to display the body message.

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

Incoming search terms:




You will also be interested in ,

One Response to “HTML E-mail Using PHP”

  1. September 7, 2009 at 7:01 pm #

    Please let me know if get any mail.

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)

Leave a Comment

Spam protection by WP Captcha-Free

Affordable Seo PackagesSeo BlogEdu Backlinks
More in Css, Flash, JavaScripts, Others, scripts, Tools, Wordpress Tips (150 of 185 articles)