Page 1 of 1

Problems with sending html emails using mail()

Posted: Fri Aug 02, 2002 5:05 am
by holy0
Hi I’m sending an html email using the mail() function, my problem is it seems to put a lot of ! in the html code. Is there anyway to stop this happening?

If I echo the email body rather than sending it , it works fine. Its only when I email it.

Any help would be appreciated.

Cut down version of the code is :


$headers .= "From: test <$re_email>\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";

$email_body.="<table width=550 border=0 cellspacing=0 cellpadding=0 bgcolor=#dddddd class=products>";
$email_body.="<tr><td>Customers Details</td></tr>";
$email_body.="</table><br>";

mail("homer@simpson.com","test",$email_body,$headers);

Posted: Fri Aug 02, 2002 5:33 am
by Zeceer
Don't think you need 3 bodies?`Try this:

$headers .= "From: test <$re_email>\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";

$email_body.="<table width=550 border=0 cellspacing=0 cellpadding=0 bgcolor=#dddddd class=products> <tr><td>Customers Details</td></tr> </table><br>";

mail("homer@simpson.com","test",$email_body,$headers);

Posted: Fri Aug 02, 2002 5:36 am
by twigletmac
You need to send the e-mail with a MIME type check the man entry for mail() for all the headers that need to be set when sending HTML e-mail. Don't know if this'll solve the problem but it might help.

Zeceer - that shouldn't make any difference, all that he's doing is concenating the HTML so that he doesn't have to type it all on one line.

Mac

Posted: Fri Aug 02, 2002 6:19 am
by holy0
Cheers for the help ... it doesn’t solve the problem. But I’m starting to think its outlook that has the problem.

I've just sent the email to a web based mail account and it looks fine. and has no ! at all .. a little strange..