Jump to content


Multiple stylesheets in emails

  • Please log in to reply
3 replies to this topic

#1 mort

  • Members
  • PipPipPip
  • Advanced Member
  • 82 posts

Posted 27 September 2006 - 04:47 PM

Made an eShot so that it sends an email via PHP to a database of emails

Want to make it a multiple stylesheets email, as will be going out to people using outlook, firefox, and entourage (macs). Thing is, like browsers, all email clients read the HTML and CSS differently.

Currently I do that with PHP and HTTP_USER_AGENT to decide what the browser is, but obviously cant get PHP to run in email clients as its server side. So any idea how to detect the email browser and specify the stylesheet without PHP


#2 ToonMariner

  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 28 September 2006 - 02:32 AM

You can't - they could open up the email in what ever agent they want you are simply sending mail to an inbox. The only thing you coudl do is ask the user which client they use and store that in the database and use that value to switch style sheest.

You shoudl read up on css support in email agents - its not very good.

Also web based e-mail like yahoo and hotmail do all kinds of funny things to html emails - like sticking an x on the front of any id attribute value.

Best possible result is in-line css and an absolute minimum
I have actually resorted to table layouts and using html to do the formatting - not good But works on in the non-standards compliant world of html e-mail.
follow me on twitter @PHPsycho

#3 mort

  • Members
  • PipPipPip
  • Advanced Member
  • 82 posts

Posted 28 September 2006 - 12:21 PM

hah you were right, it was totally FUBAR'ed when viewed in entourage, as in not one element was in the right place, all the image backgrounds were tiled all over the place
not good lol

thanks for the tip though. Any idea about if margins or padding would work for positioning text inside a table?

#4 Ninjakreborn

  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 September 2006 - 10:40 PM

http://www.google.co...n email clients
very top search result should cover everything.


Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users