Knock now supports MJML, a responsive email framework that compiles to HTML optimized for email clients. MJML abstracts away the complexity of table-based layouts and media queries, so you can build component-based emails that look great across devices with less code.

Building email templates with MJML in Knock

You can use MJML for both email layouts and email templates:

  • Layouts work much like HTML layouts: they must include a root <mjml> tag, {{ content }} inserts the template body, and {{ footer_links }} inserts footer links when configured.
  • Templates can be written fully in MJML or built in the visual editor, where blocks render as MJML components when the template or layout uses MJML. When using a layout, both the layout and template must be MJML.

Knock also supports mixing in plain HTML by wrapping it in <mjml-raw> automatically, so existing HTML snippets can still render correctly within MJML.

Learn more about MJML support in our documentation.