Yes you can send a multi-part message with one part plain text and the other part containing your HTML. Clients that understand MIME, but not HTML will render the plain text version and ignore the HTML. Clients that understand HTML will render the HTML. Here is an example:
<?php
$to="Recipient Name <
[email protected]>";
$from="Sender Name <
[email protected]>";
$subject="Subject";
// HTML
$mime_boundary="==Multipart_Boundary_x".md5(mt_ran d())."x";
$headers = "From: $from\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type:multipart/alternative;\n" .
" boundary=\"{$mime_boundary}\"\r\n";
$headers.= "From: $from\r\n";
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
// Plain Text Part
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
"HTML E-mail\n\nThis is the text portion of an HTML e-mail\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
"<h1>HTML E-mail</h1>" .
"<p>This is an <b>HTML</b> e-mail.</p>";
if (mail($to, $subject, $message, $headers))
echo "Message Sent!";
else
echo "Failed to send message.";
?>
Take note that the content type is set to "multipart/alternative". Then we place boundary markers between the two versions of the message and set a content type for each part. What this means is that we're sending two versions of the message. The e-mail client can choose which of these to display. If the e-mail client understands HTML, it will display it. If it doesn't understand HTML, it will display the plain text version.
Hope that does the trick.
Everything is temporary, some things are just more temporary than others... except for death, that seems to be pretty permanent