Drupal is a registered trademark of Dries Buytaert
Search API Solr 4.4.0 Minor update available for module search_api_solr (4.4.0). Page Manager 8.x-4.0 Major update available for module page_manager (8.x-4.0). Trash 3.1.0-beta2 New beta version released for module trash (3.1.0-beta2). Commerce AutoSKU 3.0.1 Minor update available for module commerce_autosku (3.0.1). Custom Field 4.0.10 Minor update available for module custom_field (4.0.10). Alternative login ID & display names 2.0.12 Minor update available for module alt_login (2.0.12). EntityReference UUID 3.0.1 Minor update available for module entity_reference_uuid (3.0.1). LocalGov Publications Importer 1.1.1 Minor update available for module localgov_publications_importer (1.1.1). Configuration Override Warn 8.x-1.6 Module config_override_warn updated after 10 months of inactivity (8.x-1.6). Table Alternate Rows Module table_altrow crossed 1,000 active installs.

MJML Render Engine

2 sites Security covered
View on drupal.org

This project provides a Drupal theme engine that allows you to write responsive email templates using MJML syntax within Twig. It processes your templates through Twig for logic and then converts the MJML markup into cross-client compatible HTML emails without requiring Node.js. This enables creating transactional emails, marketing newsletters, and decoupled email rendering with full Twig capabilities.

A Drupal theme engine that extends Twig with MJML support for building responsive email templates. Write your email templates with full Twig capabilities — variables, includes, extends, blocks — and let MJML handle the responsive HTML output.

Requires Drupal 11.3.0 or later.

What It Does

This module registers a custom theme engine named twig_mjml that plugs into Drupal's ThemeEngineInterface. Templates use the .html.twig.mjml extension and are processed in two stages:

  1. Twig compiles and renders the template — resolving all variables, {% include %}, {% extends %}, and {% block %} directives
  2. MJML receives the fully resolved MJML markup and converts it into responsive, cross-client HTML email

No Node.js is required at runtime. The MJML rendering is handled by a pre-built standalone binary provided by the MJML Render Binary package.

Use Cases

Transactional Emails
Render order confirmations, password resets, account notifications, and other system emails using MJML templates with Twig variables. Combine with modules like Symfony Mailer for a complete email solution.
Email Marketing Templates
Build reusable newsletter and campaign templates that render consistently across all major email clients (Gmail, Outlook, Apple Mail, Yahoo). MJML handles the complex responsive table-based layouts automatically.
Commerce Order Emails
Create branded, responsive emails for Drupal Commerce — order receipts, shipping notifications, abandoned cart reminders — with full access to Twig's templating power and Commerce's render arrays.
Multisite Email Branding
Set up a dedicated email theme per site in a multisite environment. Each theme uses engine: twig_mjml and can have its own set of MJML templates while sharing common Twig partials via {% include %}.
Headless / Decoupled Email Rendering
Use Drupal as a backend email renderer for decoupled architectures. The theme engine produces HTML email markup that can be consumed by any mail delivery service or API.

Installation

composer require drupal/mjml_render_engine
drush en mjml_render_engine

Quick Start

1. Create an email theme

Create a theme that uses the twig_mjml engine:

# themes/custom/mail/mail.info.yml
name: 'Mail Theme'
type: theme
description: 'Email theme using MJML templates.'
core_version_requirement: ^11.3
engine: twig_mjml
base theme: false

2. Write MJML templates

Templates use the .html.twig.mjml extension: see README.md example

3. Include and extend other templates

Full Twig inheritance works — include both .html.twig and .html.twig.mjml files: see README.md example

Custom Binary Path

In case you need to use a different binary location, you can override the MJML binary location in settings.php or settings.local.php:

$settings['mjml_render_bin.path'] = '/path/to/custom/mjml';

See the MJML Render Binary project for Docker commands to build custom MJML binaries for any version or platform.

Requirements

  • Drupal 11.3.0+ (uses ThemeEngineInterface introduced in 11.3)
  • MJML Render Binary (installed automatically as a Composer dependency)

Related Projects

  • MJML Render Devel — the UI module for MJML templates development and testing
  • MJML Render Binary — the standalone MJML binary package (no Node.js at runtime)
  • MJML — the responsive email framework

Activity

Total releases
5
First release
Apr 2026
Latest release
2 months ago
Releases (12 mo)
5 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Release date
1.0.0 Stable May 4, 2026
1.0.x-dev Dev May 4, 2026
1.0.0-alpha3 Pre-release Apr 28, 2026
1.0.0-alpha2 Pre-release Apr 28, 2026
1.0.0-alpha1 Pre-release Apr 27, 2026