Trent
Trent

Reputation: 87

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>
</table>
</body>
</html>

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

Upvotes: 1

Views: 608

Answers (3)

Trent
Trent

Reputation: 87

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.

Upvotes: 0

red eyes dev
red eyes dev

Reputation: 398

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>

Upvotes: 1

Francis Gilbert
Francis Gilbert

Reputation: 3442

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

Upvotes: 1

Related Questions