hello:
I am working through "Beginning PHP5 Web Development", by WROX, and I am
having trouble sending HTML email messages in one application. The email
goes through, but is displayed only as text/plain not text/html.
Here are the headers:
Date: Wed, 25 Oct 2006 14:05:03 -0400
To: XX*@gmail.com
Subject: Please Confirm your postcard
MIME-Version: 1.0
Content-type: multipart/alternative; boundary="==MP_ Bound_56gdfg56g d56gg=="
From: no******@postca rdorama.com
X-vif-MailScanner-Information: Please contact the ISP for more information
X-vif-MailScanner: Found to be clean
X-vif-MailScanner-From: no******@postca rdorama.com
This is a Multipart Message in MIME format
--==MP_Bound_56gd fg56gd56gg==
Content-type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
<html><body>(ht ml)Hello glennsend,
Please click on the link below to confirm that you would like to send this
postcard:
<center><tabl e width="500" border=0 cellpadding="4" ><tr><td>Greeti ngs, glenn
rec!</td></tr>
<tr><td>glennse nd has sent you a postcard today.<br>Enjoy !<td></tr><tr><td
align="center"> <img src="http://localhost/mail/postcards/congrats.gif"
border="o"></td></tr><tr><td align=center></td></tr><tr><td
align=center>En ter your message here:
</td></tr></table></center>
<a href="http://localhost/mail/confirm.php?id= 1b55d1414b145e3 170f70e111336e4 37">
Click here to confirm</a></body></html>
--==MP_Bound_56gd fg56gd56gg==
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
(text)Hello glennsend,
Please visit the following URL to confirm your postcard:
http://localhost/mail/confirm.php?id...f70e111336e437
--==MP_Bound_56gd fg56gd56gg==--
And the relevant PHP code:
$boundary = "==MP_Bound_56g dfg56gd56gg==";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: multipart/alternative; boundary=\"$bou ndary\"\r\n";
$message = "This is a Multipart Message in MIME format\n";
$message .= "--$boundary\n";
$message .= "Content-type: text/html; charset=iso-8859-1\n";
$message .= "Content-Transfer-Encoding: quoted-printable\n\n";
$message .= $confirmmessage . "\n";
$message .= "--$boundary\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$message .= "Content-Transfer-Encoding: 7bit\n\n";
$message .= $textconfirm . "\n";
$message .= "--$boundary--";
If someone can tell me why this does not appear as html, I would be most
grateful, as I have been puzzling over this for 2 days now ;(
Glenn