Set up your email message with text/html boundaries as follows:
[cc lang=”php”]
–$boundary
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Text email content goes here
–$boundary
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit
HTML email content goes here
–$boundary–
[/cc]
Let’s say the message above is in the variable $message.
Set headers and send email.
[cc lang=”php”]
$boundary = uniqid(“”, true);
$additional_headers = “Mime-Version: 1.0rn”;
$additional_headers .= “Content-Type: multipart/alternative; boundary=$boundary” . “rn”;
mail($to, $subject, $message, $additional_headers, $additional_parameters);
[/cc]
If the user’s email client supports HTML, it will show the HTML version, otherwise, it’ll show the text version.