Hemmer - A Rust library for transforming HTML into email-client-ready output

Hey! :waving_hand: I made a thing!

Well, mostly Claude but I did have some say in the matter. :grinning_face_with_smiling_eyes:

It is a library for transforming HTML to email client optimized output. It was inspired by Maizzle, but as that is a node based project it did not fit very nicely with our Phoenix app and we also had some other use-cases we would like to have supported.

Story time!

We currently use MJML to create our emails in the apps we want some something else than plain text emails, but we found that it was hard to figure out what the end result would look like, with a sub-par feedback cycle, and had some issues related to different rendring in different email client (some important buttons just disappeared in gmail for some reason :smiling_face_with_tear:).

Also we had an experiment where we wanted an LLM-based agent to produce parts of the email and it had problems getting it right with MJML. But plain HTML and CSS, and also Tailwind, is something they do well so I searched for some projects similary to MJML and possible Tailwind support and found Maizzle. Its Nodejs based and already there it was a bit of a showstopper as I would like to not add node as a depenency and also it requires a build step as far as I understood. It also has its own template system which we dont need as we will just use HEEx.

I’m sure Maizzle a great project but it did not quite fit our needs. It did spark an idea though: what if we could create a library that could do the most important transformations for producing email optimized HTML, with Tailwind support, if you are so inclined, at runtime.

So thought, so done, as we say in Norwegian, or β€œNo sooner said than vibe coded” might be a bit more correct her. :stuck_out_tongue:

The fun side effect of this for us is that we can create the email template/design in a way that is much easier to validate, whether its artisanally handcrafted or LLM-aided or generated.

Hemmer is a rust crate and a hex package packaged and delivered with rustler and rustler_precompile.

It has transformers for CSS inlining, table attribute defaults, Outlook conditional comments, rem β†’ px conversion, CSS variable resolution, and other smaller fixes and optimalizations.

TL;DR: Hemmer is a rust and elixir library for optimizing HTML for email. It’s early and tested to work well with a sample size of one, but you are free to give it a try if you want. :smile:

2 Likes