PHP - problem with sending table in php mail - Asked By Olusegun A. on 14-Oct-10 06:25 AM

I am having problem with sending a table in php mail.
i have searched for help in and forums, but the reply am getting is as below;

/*my content will go here*/


$message = '
<table>/*my content will go here*/</table>

which i tried but it will always show the table codes in the mail, not making the mail look readable.

what else can i do?

_ash_ k replied to Olusegun A. on 14-Oct-10 06:37 AM
You need to ensure that you pass the optional params in the mail() function. The last parameter, the headers, are optional for the function but required for sending HTML email, as this is where we are able to pass along the Content-Type declaration telling email clients to parse the email as HTML.
$to = '';
$subject = 'Website Change Reqest';
$headers = "From: " . strip_tags($_POST['req-email']) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
$headers .= "CC:\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html><body>';
$message .= '<h1>Hello, World!</h1>';
$message .= '</body></html>';

Then make the function call - mail($to, $subject, $message, $headers);

Hope this helps.