MJML to HTML via CLI

Render Processwire MJML templates to converted HTML output using a CLI based compiler, like the rust based MRML.

MJML to HTML via CLI module

Module for ProcessWire CMS
Copyright (c) 2026 Commonwealth of Australia

Convert MJML templates to HTML using a CLI compiler like the MRML rust compiler.

A ProcessWire CMS module that converts MJML email templates to HTML using a locally installed CLI compiler.

Unlike other ProcessWire MJML solutions that rely on the hosted MJML API service, this module performs compilation directly on your web server using a compatible MJML CLI compiler such as MRML. This provides a fully self-hosted solution with no external API dependencies, network requests, usage limits, or third-party service requirements.

This module is best used in conjunction with the ProMailer module for easy sending of emails directly from ProcessWire.

Why use this module?


  • Fully self-hosted MJML compilation
  • No dependency on the MJML API service
  • No API keys or external accounts required
  • Works in environments with restricted outbound internet access
  • Faster rendering when using native compilers such as MRML
  • Ideal for organisations with security, privacy, or compliance requirements

Requirements


Supported Compilers

The module can work with any CLI tool that accepts MJML input, validates it and outputs compiled HTML.

The CLI tool must support the following commands:

  • mjml render {filename}
  • mjml validate {filename}

We recommend using MRML (Rust implementation) - it's fast and lightweight.

Installing


Install an MJML CLI compiler

Before installing this module, install a compatible MJML CLI compiler on the server.

For example:

  • MRML
  • Other compatible MJML compiler ports

Ensure the compiler executable is accessible by the web server user and note its full path for module configuration.

Intsalling the module in ProcessWire

This module is installed just like any other ProcessWire module: copy or clone the directory containing this module to your /site/modules/ directory, log in, go to Admin > Modules, click "Check for new modules", and install "MJML to HTML via CLI".

How it works


  1. A page is rendered that uses a MJML template selected in the module config
  2. The module captures the generated MJML markup
  3. The configured CLI compiler is executed
  4. The MJML output is compiled to responsive HTML
  5. The resulting HTML is returned to ProcessWire, optionally for use in email delivery workflows such as ProMailer or a WireMail call

Configuration


Path to CLI

Enter the path to the compiler executable to your intended MJML compiler. We recommend the MRML rust compiler, as it is very fast. After saving, the module will then check the provided path can validate a test MJML file successfully - providing an error if not.

Choose which templates to render

Choose one or more templates which output MJML and should be converted to HTML at render time.

Error message shown to editors

Allows you to specify an error message which is shown to non-superuser editors when they attempt to view the page when an error occurs. Commonly used to suggest the editor contact a superuser or developer for support.

Using this module


Render MJML from template

Once you have installed the module, and configured it to render your selected templates, then you should just be able to render the templates as HTML.

This module is intended for use with the ProMailer module for easy sending of emails directly from ProcessWire.

Rendering MJML from a string

You can also render MJML to HTML wherever needed using $module->renderMJMLString(string $mjml)

$mjml = "<mjml></mjml>"; // MJML content as a string

/** @var PageMjmlToHtmlViaCli $pageToMjml */
$mjmlToHtml = $modules->get("PageMjmlToHtmlViaCli");

$result = $mjmlToHtml->renderMJMLString($mjml);
echo $result;

Error Handling


If the confiured compiler cannot be executed or compilation fails:

  • Superusers will see detailed error information
  • Non-superuser editors will see the configured editor-friendly error message
  • Invalid compiler paths are detected during module configuration

More modules by Australian Antarctic Division

  • Replace Microsoft Protected Links

    Replace protected links from Outlook/Teams/Microsoft Office with the original link.
  • MJML to HTML via CLI

    Render Processwire MJML templates to converted HTML output using a CLI based compiler, like the rust based MRML.

All modules by Australian Antarctic Division

Install and use modules at your own risk. Always have a site and database backup before installing new modules.