#email #mjml


Rust implementation of MJML renderer

18 releases (7 stable)

1.2.4 Jun 3, 2021
1.2.0 Apr 21, 2021
0.5.0 Jan 31, 2021
0.4.0 Oct 24, 2020
0.2.0 Jun 8, 2020

#6 in Email

Download history 5337/week @ 2021-04-05 5454/week @ 2021-04-12 5387/week @ 2021-04-19 5546/week @ 2021-04-26 5601/week @ 2021-05-03 5771/week @ 2021-05-10 6014/week @ 2021-05-17 5857/week @ 2021-05-24 6048/week @ 2021-05-31 5656/week @ 2021-06-07 5786/week @ 2021-06-14 5977/week @ 2021-06-21 5845/week @ 2021-06-28 5872/week @ 2021-07-05 6449/week @ 2021-07-12 5660/week @ 2021-07-19

23,736 downloads per month
Used in mrml-cli

Custom license

12K SLoC


Crates.io Crates.io

Build Status codecov

Average time to resolve an issue Percentage of issues still open Maintainability


This project is a reimplementation of the nice MJML markup language in Rust.

How to use it in the cli

# installing mrml-cli
cargo install mrml-cli
# using it 
mrml-cli path/to/template.mjml validate
mrml-cli path/to/template.mjml render
mrml-cli path/to/template.mjml format-json --pretty
mrml-cli path/to/template.json format-mjml --pretty
# getting some help
mrml-cli --help

How to use it in my code

Update your cargo.toml.

mrml = "1.2"
serde = { version = "1.0", features = ["derive"] }

Create your main.rs

use mrml;

fn main() {
    let root = mrml::parse("<mjml><mj-body></mj-body></mjml>").expect("parse template");
    let opts = mrml::prelude::render::Options::default();
    match root.render(&opts) {
        Ok(content) => println!("{}", content),
        Err(_) => println!("couldn't render mjml template"),


  • A Node server rendering a mjml template takes around 20Mo of RAM at startup and 130Mo under stress test. In Rust, less than 1.7Mo at startup and a bit less that 3Mo under stress test. The Rust version can also handle 2 times more requests per seconds. You can run the bench by doing bash script/run-bench.sh.
  • The JS implementation cannot be run in the browser. In Rust (and Wasm), you can.

You want to contribute?

Feel free to read our contributing section and the code of conduct.


With the same linux amd64 machine, to render the amario template

  • Node: 606.59ms
  • Rust: 3.48ms

To reproduce those results, you can follow the configuration in the gitlab-ci.yml or look on codebench.cloud

Missing implementations

  • mj-style[inline]: not yet implemented. It requires parsing the generated html to apply the inline styles afterward (that's how it's done in mjml) which would kill the performances. Applying it at render time would improve the performance but it would still require to parse the css.
  • mj-include: not yet implemented. It requires to handle loading remote templates when using mrml in a wasm (browser or server side) format, which implies being able to load from a different location (file://, https://, relative, etc).

Who is using MRML?

If you are using MRML and want to be added to this list, don't hesitate to create an issue or open a pull request.

What is using MRML?

mjml_nif - Elixir library

If you are using MRML and want to be added to this list, don't hesitate to create an issue or open a pull request.

You want to sponsor us?

Buy Me A Coffee

Thanks to zachzurn.