Skip to main content

mjml-java

Pure Java MJML-to-HTML renderer

Zero Dependencies

Pure Java implementation with no external runtime dependencies. Just add the JAR and go.

All 31 Components

Full support for every top-level MJML renderable component, from mj-section and mj-column to mj-accordion and mj-navbar.

Thread-Safe

Designed for concurrent use in server applications. Render multiple templates simultaneously without shared mutable state.

JPMS Module

First-class Java Platform Module System support. Works seamlessly with modular Java applications.

CSS Inliner

Built-in CSS inlining engine that handles mj-style, mj-attributes, and inline styles with proper specificity.

Custom Components

Extend the renderer with your own MJML components using a simple registration API.

Quick Start

// Add to your pom.xml
// <dependency>
// <groupId>dev.jcputney</groupId>
// <artifactId>mjml-java-core</artifactId>
// <version>1.0.0-SNAPSHOT</version>
// </dependency>

import dev.jcputney.mjml.MjmlRenderer;

String mjml = """
<mjml>
<mj-body>
<mj-section>
<mj-column>
<mj-text>Hello World!</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>
""";

String html = MjmlRenderer.render(mjml).html();