Php Email Headers prob

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Glenn

    Php Email Headers prob

    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: XXX@gmail.com
    Subject: Please Confirm your postcard
    MIME-Version: 1.0
    Content-type: multipart/alternative; boundary="==MP_ Bound_56gdfg56g d56gg=="
    From: no-reply@postcardo rama.com
    X-vif-MailScanner-Information: Please contact the ISP for more information
    X-vif-MailScanner: Found to be clean
    X-vif-MailScanner-From: no-reply@postcardo rama.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:


    --==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

  • Geoffrey

    #2
    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.


    Geoffrey



    Glenn wrote:
    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: XXX@gmail.com
    Subject: Please Confirm your postcard
    MIME-Version: 1.0
    Content-type: multipart/alternative; boundary="==MP_ Bound_56gdfg56g d56gg=="
    From: no-reply@postcardo rama.com
    X-vif-MailScanner-Information: Please contact the ISP for more information
    X-vif-MailScanner: Found to be clean
    X-vif-MailScanner-From: no-reply@postcardo rama.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:
    >

    --==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

    Comment

    • Glenn

      #3
      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
      HTML??


      Thanks again!

      Glen
      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.
      >
      >
      Geoffrey
      >
      >
      >
      Glenn wrote:
      >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:
      <snip>

      Comment

      Working...