mjml-python is a Python wrapper for MRML, a high-performance Rust port of MJML. It enables rendering MJML templates into email-compatible HTML entirely within Python, eliminating the need for external Node.js services or subprocesses. Currently at version 1.4.0, the library is actively maintained with regular updates, often coinciding with upstream MRML changes.
pip install mjml-pythonVerified import paths — ran on the pinned version, not inferred.
Render a basic MJML string to HTML. The `mjml2html` function takes the MJML string and optional keyword arguments for customization, such as disabling comments or specifying custom fonts. It returns a result object containing the rendered HTML and any errors encountered.
Always use `pip install mjml-python` to ensure you get this specific wrapper.
Consult the project's GitHub README for current limitations and supported features.
Strictly validate and sanitize any untrusted user input before incorporating it into MJML templates.
Review `mjml-python` release notes and MRML changelogs when upgrading across `mjml-python` minor/major versions to identify any necessary adjustments to MJML templates or rendering options.
Install the `css_inlining` extra by running `pip install "mjml-python[css_inlining]"`.
Review the MJML input for syntax correctness, ensure it includes a root `<mjml>` tag and a `<mj-body>` tag, and validate it against the MJML specification. Example: `<mjml><mj-body><mj-section><mj-column><mj-text>Hello</mj-text></mj-column></mj-section></mj-body></mjml>`.
Ensure `mjml-python` is correctly installed (`pip install mjml-python`) and use the correct import statement: `from mjml import mjml_to_html`.
No dependency data recorded yet.