mjml2html - Generate HTML Email Body with MJML

Generates a HTML email body from a MJML template
The function mjml2html generates an HTML email body from a MJML template. It requires a string input in the form of a MJML template, and the output is the corresponding HTML email body. The function also has an optional parameter called validationLevel, which specifies the level of validation to be performed on the MJML template before rendering. The possible values for this parameter are skip, soft, and strict. The function is part of the MJML library, which was created to simplify the process of coding responsive email designs. The library abstracts the complexity of responsive HTML and automatically generates it, making it easy to build responsive emails with tags such as mj-section and mj-column. With MJML, users can write high-level code through extensible and reusable components, and build their own custom components as well.

You can also embed images by generating a base64 image based on using the function files/asset2base64

Examples

Input: Hello World!

Output: Corresponding HTML email body.


Input:

Output: Corresponding HTML email body with image.

Input: Click Here

Output: Corresponding HTML email body with button.

Note: The MJML library used in this function can be found at https://mjml.io. Use the template editor to create your templates.

mjml
Type
string
Required
required
MJML Template. See https://mjml.io for further informations.
Example:
<mjml><mj-body><mj-section><mj-column><mj-text>Hello World!</mj-text></mj-column></mj-section></mj-body></mjml>
validationLevel
Type
string
MJML is rendered without going through validation. soft: MJML is going through validation and is rendered, even if it has errors. strict: MJML is going through validation and is not rendered if it has any error. Defaults to skip.
Possible values are: skip, strict, soft
Example:
skip

Available on

Postman
Make
Zapier
N8N
Airtable
SeaTable
Bubble
Power Automate
Workato
SAP Build