Drupal is a registered trademark of Dries Buytaert
drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! linkit 7.0.14 Minor update available for module linkit (7.0.14). masquerade 8.x-2.2 Minor update available for module masquerade (8.x-2.2). video_embed_field 3.1.0 Minor update available for module video_embed_field (3.1.0). bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). editoria11y 3.0.0 Major update available for module editoria11y (3.0.0). trash 3.0.27 Minor update available for module trash (3.0.27). twig_tweak 4.0.0-alpha2 New alpha version released for module twig_tweak (4.0.0-alpha2). twig_tweak 4.0.0-alpha1 First alpha version released for module twig_tweak (4.0.0-alpha1). node_revision_delete 2.1.1 Minor update available for module node_revision_delete (2.1.1). commerce_paypal 2.1.2 Minor update available for module commerce_paypal (2.1.2).

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

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 Binary — the standalone MJML binary package (no Node.js at runtime)
  • MJML — the responsive email framework

Activity

Total releases
1
First release
Apr 2026
Latest release
18 hours ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
1.0.0-alpha1 Pre-release Apr 27, 2026