NathanLedet Posted June 30, 2008 Share Posted June 30, 2008 I have a script that $to = you@you.com; $subject = "subject goes here"; $body = "<p style=color: #0000ff;>text goes here</p>"; $headers = "From: Nate L <me@mysite.com>\r\n" . "X-Mailer: php"; $headers .= "Content-type: text/html\r\n"; if (mail($to, $subject, $body, $headers)) { echo("<p>Message sent</p>"); } else { echo("<p>Message delivery failed...</p>"); } When the e-mails come in, the HTML is displayed, but not rendered out. I would appreciate some help with this Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 30, 2008 Share Posted June 30, 2008 first thing add a \r\n at the end of this line (i added it here): $headers = "From: Nate L <me@mysite.com>\r\n" . "X-Mailer: php\r\n"; but you will find a lot of email clients don't honor CSS attributes...you have to use "old school" styling: $body = "<p><font color=\"#0000ff\">text goes here</font></p>"; Quote Link to comment Share on other sites More sharing options...
br0ken Posted June 30, 2008 Share Posted June 30, 2008 By displayed but not rendered do you mean you wish to see the tags rather than them actually being used to style the information? If so use... <?php echo htmlspecialchars($var); ?> Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 30, 2008 Share Posted June 30, 2008 p.s. - what email client are you using to receive emails? Quote Link to comment Share on other sites More sharing options...
NathanLedet Posted June 30, 2008 Author Share Posted June 30, 2008 when the e-mails are coming in, you can see the <p></p> tags..none of the HTML is rendered. I actually want the text to render out in blue. I'm testing on a few e-mails...my yahoo account is one, the other one is my mac Mail app. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted June 30, 2008 Share Posted June 30, 2008 first thing add a \r\n at the end of this line (i added it here): $headers = "From: Nate L <me@mysite.com>\r\n" . "X-Mailer: php\r\n"; but you will find a lot of email clients don't honor CSS attributes...you have to use "old school" styling: $body = "<p><font color=\"#0000ff\">text goes here</font></p>"; and you've made these changes from above? Quote Link to comment Share on other sites More sharing options...
NathanLedet Posted June 30, 2008 Author Share Posted June 30, 2008 I replied before making the changes.... I just made them and it works! Thanks for your help!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.