views:

2365

answers:

6

When you take a look at http://www.campaignmonitor.com/css/ you learn that you need to embed inline styles in your HTML, in order for your email to be read in any mail client.

Do you know any tools or script to automatically convert an HTML file with a declared in to an HTML file with only inline CCS style attributes ?

Edit: Any Javascript solution ( ie: http://www.robertnyman.com/2006/04/24/get-the-rendered-style-of-an-element/ ) ? With jQuery ?

A: 

I would just do it in an HTML editor, and copy and paste it in.Just make sure you use inline styles. Just try to not use ones that aren't supported very well - as far as I am aware there are not any dedicated tools for this.

patricksweeney
"HTML editor, and copy and paste it in"? You can't be serious. This a programmers forum and I am sure Pierre-Jean was looking for a computer-aided solution.
Peter Perháč
Yea, and I hate to tell you, thats how most people do it. It's not something you edit over and over, so its generally not worth the time to spend rolling your own solution or spending money on it. You don't write 4 or 5 email campaigns every single day correct?
patricksweeney
Pierre-Jean Coudert
@patricksweeney: You may not be editing 4 or 5 email campaigns every day, but when the time comes to edit an email for a white-label product where you have lots of different brandings that need to be applied it's rather tedious to have to redo EVERYTHING.
Mr. Shiny and New
Having done this a couple of times in the last couple of days - it is hard to find a generic solution that can fix you code for all the email clients that people use. There are issues when build emails that simply inlining all the CSS would not fix. Try looking at an email in outlook 2007 then in 2003 and then in live to see what I mean.
matpol
A: 

I highly doubt you will find any program out there that will take an external stylesheet and parse it into inline styles.

If anything you best bet would be to use one of the many WYSIWYG editors like TinyMCE that will apply styling inline as you set it - like the one we use on here for example ;)

Phunky
What brings you to the conclusion, that there couldn't be a program to parse CSS selectors and HTML elements and then to join that knowledge (a.k.a. what browsers do)?
Boldewyn
I never said there couldn't be a program that did this, I said I doubt you would ever find one that did...
Phunky
A: 

My advice to you is, please drop the "fancy" stuff in a newsletter. A newsletter is to be simple and focus on the points of a/some subject/s, and that's it... for the fancy stuff the user will click in the link and follow if he wants to read more about it. So, pay attention to your subject headers instead trying to create a "cool effect".

Don't try to make from a newsletter a website page, that's why we called newsletter and not web page in the email.

you should also read MailChimp advice on creating newsletters, just check their resources, it's as good as campaign monitor. And you can have, for free, 600 emails to send just for fun, use them to test your newsletter...

Campaign monitor templates are incredible great, use one and follow the guidlines, remember that you have limitations on the CSS to use, even inline...

balexandre
+8  A: 

Check this online converter, it may help
http://code.dunae.ca/premailer.web/

Saleh Al-Zaid
Thanks for this link !It seems to be exactly what I was looking for.
Pierre-Jean Coudert
Looks like Premailer moved to a new URL: http://premailer.dialect.ca/
Matt Huggins
+1  A: 

It's not enough to simply inline your CSS. There are no observed standards as to how an HTML email will be shown in whatever email client is used. They all do it differently, and the more you design your email the more likely it is that it will break in a greater amount of clients. Many professionals in this space simply use images and tables and maybe some background colors, but nothing else. Always include a link to a website that has a working copy of the email and always provide a plain text variant.

apphacker
+2  A: 

EDIT: I ended up writing such a script myself : Inline2Mail.

Front compiler does something like that but it implies javascript. Finally you have a Python and a Ruby script to do it.

e-satis