Sending PHP Mail with HTML in Body

This program can be used to send automated e-mails.

I use this program to send e-mails during the registration process on websites.

It supports HTML as well means you can add HTML Tags to the mail body:

$msg = <<<EOPAGE
Hello,<br /><br />
<strong>My Name :</strong> Only For testing<br />
<strong>Email :</strong> example@gmail.com<br />
<strong>Message :</strong> hello this is for testing only
http://www.php.net/manual/en/index.php
<br />
Thanks
EOPAGE;
$to = 'example@gmail.com';
$from = 'admin@example.com';
$subject = "Subject goes here…..";
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
$headers .= 'From: Name <admin@example.com>' . "rn";
$headers .= 'Reply-To:admin@example.com' . "rn";
$headers .= 'X-Mailer: PHP/' . phpversion() . "rn";
mail($to, $subject, $msg, $headers);

you can use more headers to the e-mail.

Share this post