Php Email Headers prob

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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
Subject: Please Confirm your postcard
MIME-Version: 1.0
Content-type: multipart/alternative; boundary="==MP_Bound_56gdfg56gd56gg=="
X-vif-MailScanner-Information: Please contact the ISP for more information
X-vif-MailScanner: Found to be clean

This is a Multipart Message in MIME format
Content-type: text/html; charset=iso-8859-1

<html><body>(html)Hello glennsend,

Please click on the link below to confirm that you would like to send this

<center><table width="500" border=0 cellpadding="4"><tr><td>Greetings, glenn
<tr><td>glennsend 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>Enter your message here:


<a href="http://localhost/mail/confirm.php?id=1b55d1414b145e3170f70e111336e437">
Click here to confirm</a></body></html>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

(text)Hello glennsend,

Please visit the following URL to confirm your postcard:


And the relevant PHP code:

$boundary = "==MP_Bound_56gdfg56gd56gg==";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: multipart/alternative; boundary=\"$boundary\"\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\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 ;(


Re: Php Email Headers prob

Hi Glenn --

Rearrange the message so that the text portion comes before the HTML.
Sounds really dumb, but it should produce the result you expect.


Glenn wrote:
Quoted text here. Click to load it

Re: Php Email Headers prob

On Wed, 25 Oct 2006 21:18:01 -0700, Geoffrey wrote:

It Worked! Thanks!

I just wonder why the order matters if my email client is set to receive

Thanks again!


Quoted text here. Click to load it

Site Timeline