Thursday 16 February 2012

HTML email in PHP

PHP's mail() function allows you to send HTML emails directly from a script.
<?
$to="abc@yahoo.com";
$subject="mail subject";
$body="mail body";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";      
$headers .= 'From: yourname <no-reply@yourdomain.com>' . "\r\n";
mail($to, $subject, $body,$headers);
?>

The above code is enough for sending HTML email to anyone by using PHP language. The code is very simple and tested.

No comments:

Post a Comment

What Is The Difference Beween Numerals and Number?

Number is a concept, it is a mathematical concept. To express the quantitative value of the object, this  is developed in ancient history. S...