Are there any tools that can embed css?

Because some email clients do not display external stylesheets correctly (or even styles in <head> HTML email messages), a CSS attachment is a common approach to try to maintain a consistent look between the website and emails. But manually setting styles is painful and error prone.

I am looking for a way to allow users to create messages using the same stylesheet as their website, but then convert the text to a more suitable email format before sending. Although, of course, you can write a tool that reads styles and the DOM by introducing the correct inline style for each element, I hope that a tool that does this is already available there. Unfortunately, my googling did not bring any useful results.

Are you aware of any tools that can embed CSS styles? I am not picky about the language, although if it does not open the source code, I will probably just write it myself.

+7
css email xhtml
source share
5 answers

The premium at http://code.dunae.ca/premailer.web/ is a good tool if your layout is simple and your HTML code is neat. It doesn’t work well on poorly formatted HTML, although I don’t know if it will be something that you are referring to the client.

The source is available at http://code.google.com/p/premailer/ . MIT License.

0
source share

There is also a premailer as a Python package.

+1
source share

For Ruby / Rails https://github.com/alexdunae/premailer . This gem is wrapped https://github.com/fphilipe/premailer-rails3 if you need compatibility with Rails 3.

0
source share

MailChimp also provides the Automatic CSS Inliner Tool on its website. It seems to work very well!

0
source share

MailerMailer provides its Magic CSS Inliner on its website. In addition, the base library that launches this page is available to Perl through CPAN and GitHub .

0
source share

All Articles