I'm trying to use PHP to compose an HTML formatted email and I'm running
into some small problems.
1) When using "Content-Type: multipart/mixed" during my testing both
Thunderbird and Gmail display the plain text and html version of the
email and Firefox attaches the html portion as an attachement.
2) When using "Content-Type: multipart/alternative" during my testing
Thunderbird only showed the HTML portion of the email but Gmail
displayed only a blank email.
3) Spam Assassin doesn't like it either way and tags the email as SPAM
for the following reasons:
0.6 HTML_SHORT_LENGTH BODY: HTML is extremely short
0.0 HTML_MESSAGE BODY: HTML included in message
1.5 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding
Here is the script, which I mostly borrowed from tutorials/how to examples on the web.
$to="Tom Ray <lists@xxxxxxxxxxxxxxxx>";
$from="Support <testing@xxxxxxxxxxxxxxxx>";
$subject="Test HTML Email";
// --> plain text part of the email
$msgtext="This is HTML Testing";
//--> html part of the email
$htmlmsg=chunk_split(base64_encode("This is <b>HTML</b> testing."));
//--> create boundary
$sep = strtoupper(md5(uniqid(time())));
//--> create email
$header = "From: $from\n";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Type: multipart/mixed; boundary=$sep\n\n";
$header .= "--$sep\n";
$header .= "Content-Type: text/plain; charset=ISO-8859-1\n";
$header .= "Content-Transfer-Encoding: 8bit\n\n";
$header .= "$msgtext\n\n";
$header .= "--$sep\n";
$header .= "Content-Type: text/html; charset=ISO-8859-1\n";
$header .= "Content-Transfer-Encoding: base64\n\n";
$header.= "$htmlmsg\n\n";
$header .= "--$sep--";
//--> mail it
mail($to, $subject, "", $header);
Any help/suggestions would be appreciated.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php