multipart/alternative e-mails; text/plain and text/htmlAccording to RFC 1341 and http://www.freesoft.org/CIE/RFC/1521/18.htm:
MIME-Version: 1.0 From: Foo <foo@bar.com> Subject: Test mail Content-Type: multipart/alternative;boundary=np69922c46956ea
This is a MIME encoded message. --np69922c46956ea Content-type: text/plain;charset=utf-8 This is the text/plain version. --np69922c46956ea Content-type: text/html;charset=utf-8 This is the <b>text/html</b> version. --np69922c46956ea--
<?php$boundary=uniqid('np');$headers="MIME-Version: 1.0\r\n";$headers.="From: Foo <foo@bar.com>\r\n";$headers.="Subject: Test mail\r\n";$headers.="Content-Type: multipart/alternative;boundary=". $boundary ."\r\n";$message="This is a MIME encoded message.";$message.="\r\n\r\n--". $boundary ."\r\n";$message.="Content-type: text/plain;charset=utf-8\r\n\r\n";$message.="This is the text/plain version.";$message.="\r\n\r\n--". $boundary ."\r\n";$message.="Content-type: text/html;charset=utf-8\r\n\r\n";$message.="This is the <b>text/html</b> version.";$message.="\r\n\r\n--". $boundary ."--";//mail('bar@foo.com', 'Test mail', $message, $headers);?>