skillfed

mjml

Python implementation for MJML - a framework that makes responsive-email easy

mjml v0.12.0 465.2K downloads/30d#6,510 on PyPI89
Permissive license MIT Active released

What it is and what it does

mjml is an unofficial Python port of the MJML markup language, a framework designed to simplify writing responsive emails. It translates MJML (an XML-like dialect) directly to HTML without needing Node.js or a JavaScript runtime. The package is implemented in pure Python and can be used either as a library (via the mjml_to_html function) or as a command-line tool.

The library was created to avoid deploying Node.js in production and to sidestep the security audit burden of the 220+ npm packages required by the official JavaScript implementation. It trades some feature completeness for a lightweight, Python-native alternative: it handles basic components like images, tables, and groups, but does not yet implement all MJML features (minification, beautification, validation). It is actively maintained and deployed in light production scenarios.

Use it for:

  • Generate responsive email HTML from MJML templates in a Python web application without Node.js overhead.
  • Build email templates programmatically using MJML markup in Django or Flask projects.
  • Convert MJML files to HTML via CLI for integration into build pipelines or batch email generation.
  • Avoid the security and dependency audit burden of npm packages by using a pure-Python email template engine.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Converts MJML (a markup language for responsive emails) to HTML without requiring Node.js, using pure Python.

Yes, if you need to generate responsive emails from MJML templates in Python and want to avoid Node.js. The package is actively maintained, has low install friction, carries a permissive MIT license, and has no known vulnerabilities. Be aware that it implements a subset of MJML features and lags behind the JavaScript version; check the documentation to confirm your required components are supported before committing to production use.

Install

mjml on PyPI

pip

pip install mjml

uv

uv add mjml

poetry

poetry add mjml

Installing mjml

Before you install

Low friction: pure Python wheel with five common dependencies (beautifulsoup4, jinja2, dotmap, docopt-ng, typing_extensions). Actively maintained with recent releases; last commit 2026-03-30.

License in practice

MIT license (permissive) — you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install mjml

from mjml import mjml_to_html
with open('foo.mjml', 'rb') as mjml_fp:
    result = mjml_to_html(mjml_fp)
html: str = result.html

Requires Python 3.9 or later.

Verify before relying

  • Feature parity with the JavaScript mjml v4 implementation — the description notes the Python version lags behind and lacks minification, beautification, and validation.
  • Which MJML components are currently implemented beyond 'Hello World', images, tables, and groups.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 5 — beautifulsoup4, dotmap, docopt-ng, jinja2, typing_extensions
Maintenance actively maintained — 230 days since the last release
Last repo commit
First released
Downloads 465,237/month — #6,510 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mjml-0.12.0-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Communications :: EmailTopic :: Text Processing :: Markup :: HTML

Tags

email template markup languagemjml to html converterresponsive email generation pythonemail html buildermailjet mjml python port
email-generationmarkup-language

More HTML packages