Send an HTML Email Using PHP

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]

No comments yet.

Leave a comment

Request a Free SEO Quote