Quantcast
Channel: Programming – Programming blog – website programming blog, blog on website programming .net, java , php and mor
Viewing all articles
Browse latest Browse all 31

Send an HTML Email Using PHP

$
0
0

PHP Mail Function:

The mail() function allows you to send emails directly from a script.

Syntax For E-mail:

 mail($to,$subject,$message,$headers);

[php]
<?php
$to = "someone@example.com, someoneelse@example.com";
$subject = "HTML email ";
$message = "<table><tr><td>Congrats</tr></td></table>";
// Always set content-type when sending HTML email//Very Very Important headers</h4>
$headers = "MIME-Version: 1.0" . "\r\n";</h4>
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";// More headers</h4>
$headers .= ‘From: &lt;webmaster@example.com&gt;’ . "\r\n";
$headers .= ‘Cc: mymd@example.com’ . "\r\n";
mail($to,$subject,$message,$headers);
?>
[/php]


Viewing all articles
Browse latest Browse all 31