# peterbe/premailer

Turns CSS blocks into style attributes

Repository: https://github.com/peterbe/premailer
Canonical: https://ross.abutalabs.com/products/peterbe-premailer
Homepage: https://premailer.io
Language: Python
License: BSD-3-Clause
License Family: permissive
Last push: 2023-12-16T17:54:12+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 6258, "days_push": 991, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1083, forks 185 (observed 2026-08-28T04:03:31.335744+00:00)

## What it is
A Python library that transforms HTML email markup by converting <style> blocks and external stylesheets into inline style attributes on each element. It uses lxml to parse and modify the DOM, with options for handling pseudo-classes, external CSS, and email-client quirks.

## Use cases
- inline css for html emails
- convert style tags to style attributes
- prepare email templates for outlook and gmail
- make html newsletters email-client compatible
- inline external stylesheets in html
- remove class attributes after inlining css

## When to choose
- sending HTML emails where <style> tags are unsupported
- automating email template preprocessing in Python
- needing fine-grained control over CSS inlining behavior

## When to avoid
- styling regular web pages rather than emails
- you need a maintained project with recent releases
- non-Python stacks (use a Node or Ruby equivalent instead)

## Facets
- artifact type: library
- maturity: maintenance
- function: templating, email, parser
- domain: email, web-development, frontend
- platform: python, cross-platform
- tags: css-inlining, html-email, lxml

## Member repositories
- peterbe/premailer (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:31.335744+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:51:11.829248+00:00, confidence not recorded.
  - readme: https://github.com/peterbe/premailer (fetched 2026-08-28T04:03:31.335744+00:00, sha 0186f05d1314)
  - homepage: https://premailer.io (fetched 2026-08-29T12:53:30.746628+00:00, sha dd9498d22b85)
  - registry_pypi: https://pypi.org/pypi/premailer/json (fetched 2026-08-29T12:53:30.755800+00:00, sha cc3d26604306)
- Data as of 2026-08-30T08:39:29.467469+00:00.
