Page 1 of 1

Send email with tables?

Posted: Fri Jul 22, 2011 12:27 pm
by Sakujou
I'm trying to make an e-mail script that will have a bit of design -

and when I do this code -

Code: Select all

$first_name = "<table border=\"0\" cellpadding=\"5\" width=\"600px\" style=\"font-family:arial;font-size:12px;color:#888;\"><tr><td style=\"border:1px solid #ccc;\">Name</td>" . "<td style=\"border:1px solid #ccc;\">" . $_POST['first_name'] . " ". $_POST['last_name'] . "</td></tr></table>";
making it print in browser is fine - but when I have this send to my email, it's just raw html?

Any suggestions on how to get the table to actually show when it emails as well?

Thanks!

Re: Send email with tables?

Posted: Fri Jul 22, 2011 12:32 pm
by social_experiment
To send 'html emails' you need the correct headers in your email

Code: Select all

<?php
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'. "\r\n";
?>
Then treat the message of the email like an html document

Re: Send email with tables?

Posted: Fri Jul 22, 2011 12:48 pm
by Sakujou
Thank you - worked perfectly! :)