MJML5 min read•Audience: Developers
MJML Engine & Compilation
Technical details on MJML compilation: validation levels, error handling, timeout guarantees, and custom elements.
Key Takeaways
- PostBrix compiles MJML using strict validation level.
- Any illegal MJML tags throw an EngineError with line-specific diagnostic root causes.
- 10-second timeout safety guard prevents thread starvation during heavy compilation.
Strict Validation Guarantee#
PostBrix compiles MJML with validationLevel: 'strict'.
If a tag contains an unrecognized attribute or illegal child, compilation halts immediately with a clear error payload rather than outputting mangled HTML. This ensures you never deliver broken markup to customers.
Compilation Timeout Safeguards#
Complex email templates with hundreds of nested tables can consume significant CPU cycles:
- PostBrix enforces a strict 10-second execution deadline per compilation.
- If compilation exceeds this threshold, the worker thread is terminated and an HTTP 504 Gateway Timeout is returned, protecting cluster stability.
Frequently Asked Questions
Can I include raw HTML inside an MJML template?
Yes. Use the <mj-raw> tag to inject raw HTML or third-party templating directives directly into the document.
Does PostBrix support MJML components like mj-accordion and mj-carousel?
Yes. Interactive MJML elements are fully supported, with automated fallbacks generated for clients that do not support CSS checkbox hacks.