I want to send out an email that sends both html and plain text format in the same email.
i.e. if the persons email client supports html they see the html email and if it doesn't they see the plain text email.
I have been trying to work it out but I just can't get it. I feel I am close tho, can someone tell me where I am going wrong
Code:
$boundary="";
//Plain text
$message = "--$boundary \n";
$message .="Content-Type: text/plain \n";
$message .= "\nYour e-mail reader does not support MIME. \n";
$message .= "$plaintext";
// html
$message .= "--$boundary \n";
$message .= "Content-Type: text/html; charset=\"us-ascii\"\n\n";
$message .="<head><!-- My email--></head>"
.="<body>$htmltxt</body>";
$message .= "--$boundary--";
// Headers
$headers = "From: \"$email\" <$email>\nX-Mailer: PHP/";
$headers .= "phpversion()";
$headers .= "Mime-Version: 1.0\n";
$headers .= "Content-Type: multi-part/alternative;\n boundary = $boundary";
$headers .= "X-Priority: 1\n";
$headers .= "Return-Path: <$email>\n";
$headers .= "cc: \n";
$headers .= "bcc: \n"; //
//sends the mail
mail($To, $Subject, $message, $headers);