Premailer is a Python library for turning a HTML + CSS into HTML with all the CSS embedded as inline style attributes. This is sadly very necessary to ensure that your fancy HTML emails look spiffy across all email clients and email webapps.
So, last week I put together a little site to test the library via a browser: Premailer.io
It's just a simple webapp with a form where you can enter HTML in three different ways; textarea, by URL and by file upload.
You can also override all the possible advanced options that premailer supports.
What's kinda cool is that you can get a preview of how the HTML document will look like in an iframe that is dynamically loaded with the result from the conversion.
The webapp is of course open source and available on github.com/peterbe/premailer.io. The front-end is an AngularJS app and the build system is Lineman.js. The server is a Falcon server running on uWSGI via Nginx.
There's very little fancy here. There's no limitations or protections. I just hope it becomes handy for people to test premailer out.
The inspiration came from MailChimp's CSS Inliner Tool which is cute but very basic and doesn't allow you the same kinds of input.
If anybody with some AngularJS or highlight.js chops has time I'd love to help fix why the HTML is not syntax highlighted.
Comments
Post your own commentHey Peter,
premailer.io seems to be broken at the moment. Always gives a server error back, regardless of how big or small of a Html I put in the text-area.
Did you turn off support?
Best,
Nils
Thanks for letting me know. I'll take a look.
Seems to work now.
Yesterday (19 February 2026, AEDT time zone), Premailer.io stopped working, but later it came back. I know I can find this info online, but I thought I'd ask anyway - is there a way I can run the Premailer capability locally on my own computer? So I don't have to worry about Premailer.io going down? This must be costing you resources somewhere, I don't mind a local solution if one is available. I've searched and of course I find the GitHub versions. How can I run a local Premailer instance? Yours is the only Premailer site I can find online, and I rely on it! :-)
Hi Alex,
Yeah, premailer.io hasn't gotten any attention in years. I'm tempted to turn it off too because it's a liability.
But it shouldn't be too hard to set up locally.
After all, `premailer.io` is just a web server that executes the standalone python library `premailer`.
See https://github.com/peterbe?tab=repositories&q=premailer&type=&language=&sort=
The website is a combination of Python Falcon and a static javascript app.
The server code is all in one file: https://github.com/peterbe/premailer.io/blob/master/app.py
All it does is this:
```
import premailer
...
try:
p = premailer.Premailer(html, **options)
except TypeError as exp:
raise falcon.HTTPBadRequest("Invalid options to premailer", str(exp))
```
Unfortunately, the standalone Python library (https://github.com/peterbe/premailer) hasn't had an update in years. I think it works on modern versions of Python. But it's not maintained. But contributions are welcome!
Hi folks!
I'm new about HTML and css to inline set, and I use Knime program for automate some process and ETL. Are ther some example or some pluggind/extension to be used with the program? Can you send me some information about how to integrate it? It can be a great step for you to access more users about it and get more space into automation program's.