Send Email in Html and Plain Text formats


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

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

This is the text version of the message. 

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

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


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