Send Email in Html and Plain Text formats

 
<?php

$to = 'recipient@example.com';
$subject = 'This is the subject';
$headers = "From: sender@example.com\r\nReply-To: sender@example.com\r\n"
    . "Content-Type: multipart/alternative; boundary=\"1234567890\"";

$message =
"--1234567890
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit

This is the text version of the message. 

--1234567890
Content-Type: text/html; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit

<div>This is the html version of the message.</div>

--1234567890--";

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

?>

 

Related Snippets

•  Send Email with Attachment
•  Send Email with utf-8 characters on the subject
•  HTTP Headers to Download a File
•  Send Email in Html format
•  Send Email with CC and BCC
•  Send Email