Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Prepare HTML for email; embedd CSS to inline.

Project Description

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…

Use:

$ 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:

http://github.com/ralphbean/python-premailer

On PyPI:

http://pypi.python.org/pypi/python-premailer

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! http://pypi.python.org/pypi/premailer

Another package called pyinliner might do the job for you as well: http://pypi.python.org/pypi/pynliner

Inspired by

Emogrifier (php): http://www.pelagodesign.com/sidecar/emogrifier/

Premailer (ruby): http://premailer.dialect.ca/

Release History

Release History

This version
History Node

0.5.7

History Node

0.5.6

History Node

0.5.5

History Node

0.5.4

History Node

0.5.3

History Node

0.5.2

History Node

0.5.1

History Node

0.5

History Node

0.3dev

History Node

0.2dev

History Node

0.1deva

History Node

0.1dev

History Node

0.1dev-b

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
python-premailer-0.5.7.tar.gz (2.6 kB) Copy SHA256 Checksum SHA256 Source May 26, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting