skip to navigation
skip to content

python-premailer 0.5.7

Prepare HTML for email; embedd CSS to inline.

python-premailer converts HTML with style tags into HTML with inline style attributes; gmail won’t render nice without it!

I made it so I could send colorized git diffs of func-inventory around…


$ sudo pip install python-premailer

$ python

>>> from pypremailer import Premailer
>>> head = '<html><head><style>foo {size:10px;}</style></head>'
>>> body = '<body><span class="foo">bar</span></html>'
>>> html = '%s%s' % ( head, body )
>>> p = Premailer(html)
>>> p.premail()
    <html><head></head><body><span style="size: 10px">bar</span></body></html>

Get the source:

On PyPI:

Excuses, excuses

This definitely already exists in pypi under the name ‘premailer’, but I wanted to reimplement it without the use of lxml.

Check it out!

Another package called pyinliner might do the job for you as well:

Inspired by

Emogrifier (php):

Premailer (ruby):

File Type Py Version Uploaded on Size
python-premailer-0.5.7.tar.gz (md5) Source 2011-05-26 2KB