Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

someone wanna save my ass? HTML in email

y2kbgy2kbg New
edited May 2007 in Vanilla 1.0 Help
well the email sends, and the subject comes out right, and so does the body, except the html is stripped/ not displaying
if(isset($_POST['email'])){ $to = $_POST['email']; $subject = $_POST['fname'].' has sent you Lifes Golden Ticket'; $message = ' <html> <head> <title>Lifes Golden Ticket</title> <style> #s{ background: url(\''.$RemoteServerRoot.'emailticket.jpg\'); width: 300px; height: 136px; margin: 0px auto; padding-top: 65px; padding-bottom: 60px; padding-left: 80px; padding-right: 100px; font-family: impact; font-size: 14pt; } </style> <link href="'.$RemoteServerRoot.'ticketemailstyle.css" rel="alternate stylesheet" type="text/css"> </head> <body> Hi '.$_POST['tname'].', '.$_POST['fname'].' has sent you Lifes Golden Ticket <div id="s">'.$_POST['secret'].'</div><br /> If the above image is not showing up properly <a href="">Click Here</a> Also, Visit <a href=""></a> to send a ticket of your own. </body> </html> '; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Your Golden Ticket for Life <[email protected]>' . "\r\n"; if(mail($to, $subject, $message, $headers)){ echo '<br /><p>Your ePostcard has been sent!</p><p>Click <a href="epostcards.html">Here</a> to send another ePostcard.</p>'; } else{ echo '<br /><p>Your ePostcard did not send!</p><p>Click <a href="epostcards.html">Here</a> to send a ePostcard.</p>'; } }


  • Could it be that in your testing, your email account is set to only read in plain text?
  • I believe there is a HTML mode switch in Framework.Class.Email.php... I came across it when adopting that file for a project. You could have a look at how its done there.
  • lechlech Chicagoland
    edited May 2007
  • lech, I thought that was pretty good, considering the disclaimer on the article:
    Note: This page was originally written in 1998, maintained actively through 2004, and was sporadically updated through 2006. The author's feelings on HTML in email have largely changed since then (I no longer mind it much, and even send it myself in some contexts). This page is no longer actively updated.
    I create a couple of HTML emails each month for some clients. I'll look at the code and let you know if I can see the reason for the stripping.
  • pbearpbear New
    edited May 2007
    "Friends Don't Email Friends HTML."

    Indeed. And here I was going to recommend PowerMail...
  • y2Kbg, you've got an XHTML br close tag, but no open tag. Is that a problem?
  • ok well i had revised this some and got it working after forgetting about this thread, but the only part is that and image will not show up. i set it as a backkground in css, but it doesnt like to show itself
  • thanks lech: you have opened my eyes !
This discussion has been closed.