Premailer

Pre-flight for HTML email.

April 7 update

Mr. Templates has spun up a copy of Premailer running on their own servers, give the app a new home for the immediate future.

Thanks to Mr. Templates for taking the app on. You can check out Premailer's new home here: mrtemplates.com/premailer.

🥳

Premailer will be shutting down

Premailer has been chewing through HTML email templates since 2007(!) and has been used by 10s of thousands of people to make working with HTML email a little less horrible.

We are no longer able to keep it running. Would you like to? Here's what is involved...

  • You setup a Heroku account (or Ruby hosting of your choice)
  • Set up an S3 bucket
  • Fork the git repository and get your version up and running
  • Let me know ( code [at] dunae [dot] ca ) and we can direct people to your version :)

Be forewarned, the code is old and hasn't received much love. The dependencies are largely up-to-date though and getting running on Heroku should be pretty easy.


Many thanks to Campaign Monitor, Premailer’s sponsor. They do all this inline CSS voodoo automatically each time you send a message, and their interface is pretty, easy and powerful. If you haven't checked them out yet we heartily recommend you do.

What is this?

For the best HTML e-mail delivery results, CSS should be inline. This is a huge pain and a simple newsletter becomes un-managable very quickly. This script is our solution.

  • CSS styles are converted to inline style attributes
    Checks style and link[rel=stylesheet] tags and preserves existing inline attributes
  • Relative paths are converted to absolute paths
    Checks links in href, src and CSS url('')
  • CSS properties are checked against e-mail client capabilities
    Based on the Email Standards Project’s guides
  • A plain text version is created

A few things to note:

  • Things can get messy very quickly with the * selector—be careful
  • Only the screen, handheld and all media types are processed

Bookmarklet

If you’re using Firefox 3+, you can use a bookmarklet as a shortcut to processing pages.

To install, drag this link up to your toolbar: Premailer

Premailer API

A beta API for Premailer is now available. See the API documentation for details.

Under the hood

Premailer is written in Ruby, with a lot of help from Nokogiri, Hpricot and the Sinatra framework (goodbye eruby). The source is available on GitHub.

Written by Alex Dunae at Dialect. Copyright 2007-.