Sending HTML Email with PHP
April 3, 2014
pateldivya
Blog, PHP
(0 Comments)
<?php
// multiple recipients
$to = 'receiver@example.com' ;
// subject
$subject = 'Simple Html Email';
// message with HTML body
$message = '<html>
<head>
<title>Html Email With php</title>
</head>
<body>
<div>". strip_tags($_POST['name']) . "</div>
<div>". strip_tags($_POST['email']) . "</div>
<div>". strip_tags($_POST['message']) . "</div>
</body>
</html>';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
// Additional headers
$headers .= 'To: hello <receiver@example.com>' . "rn";
$headers .= 'From: hello <sender@example.com>' . "rn";
$headers .= 'Cc: web@example.com' . "rn";
$headers .= 'Bcc: develope@example.com' . "rn";
// Mail it
mail($to, $subject, $message, $headers);
?>
Leave a Comment
You must be logged in to post a comment.