Spencer May
Spencer May

Reputation: 4545

PHP email style

So on a website I am working on there is an automated email sent when you register. When it sends it shows the css.

$body '<span style="color:#444444;">Header</span>';

I also tried this code that I found online that had style=\"asdas\" then used a command to remove the slashes but that didn't work either. Is there a simple php code that will just simply embed the html in the email?

Upvotes: 0

Views: 1531

Answers (2)

Chuck Burgess
Chuck Burgess

Reputation: 11575

First, make sure you put the $body = as @JamWaffles suggests.

Next, are you setting your headers correctly?

$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

Upvotes: 1

alxbrd
alxbrd

Reputation: 1705

You can find a pretty detailed tutorial here: http://css-tricks.com/sending-nice-html-email-with-php/

It shows importance of headers, HTML vs txt email and user desires. It should be a good starting point for you.

You can also add a tld check in your code and assume they would have an html capable email client/web interface(gmail/yahoo/live etc) or you can just ask them to provide you with this information and then send them the emails in the format they have asked you to.

Upvotes: 0

Related Questions