开发者

HTML email bgcolor property not working correctly

I have been trying to send out html emails through a PHP mail script recently. However every time I send the email it changes from

<html>
<body>
<table bgcolor="red">
<tr><td>How does this look?</td></tr>
</table>
</body>
</html>

to

<html>
<body>
<table bgcolor=\"red\">
<tr><td>How does this look?</td></tr>
</t开发者_如何学Cable>
</body>
</html>

How do I prevent this because every time it causes the colors to change between a nasty black and lime green.


Try to escape the quotes, use single quotes, or just remove them (not ideal I know) as your code seems to see those quotes and escape them for you otherwise.

For more information on your issue see addslashes: http://php.net/manual/en/function.addslashes.php


I think your webmail add \ for parse "
Test with gmail and thunderbird.

Use simple quote '

<html>
<body>
<table bgcolor='red'>
<tr><td>How does this look?</td></tr>
</table>
</body>
</html>


I figured it out thanks to both of your guys comments!
The problem was magic quotes was enabled which I finally got disabled and it works perfectly! Just had to post a new php5.ini file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜