Skip to content
Browse all functions

Generate HTML Email Body with MJML

data/mjml2html

mjml2html (Generate HTML Email Body with MJML) is a 1001fx API function in the group Data & JSON: POST https://api.1001fx.com/data/mjml2html, 2 credits per call. It works as a ready-made module in Make and n8n or as a plain HTTP call.

2 credits per callHTTP APIn8nMake

Generates a responsive HTML email body from an MJML template.

Use cases

  • Build responsive HTML emails from an MJML template and send them from your workflow
  • Fill an MJML newsletter template with data and render it before sending
  • Keep email layouts in MJML and generate the HTML in n8n

Try it in the 1001fx app

Run mjml2html in your browser with your API key – fill the form, click Run and get the answer or the file.

mjml2html in the 1001fx app: the form with example values
Generate HTML Email Body with MJML in the 1001fx app

Endpoint

POSThttps://api.1001fx.com/data/mjml2html
Header
X-API-KEY: YOURSECRETAPIKEY How to
Content type
application/json

Parameters

  • mjmlstringrequired

    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>
  • validationLevelenumoptional

    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.

    Values:
    skip
    strict
    soft
    Default:
    skip
    Example:
    skip

Examples

MJML2HTML

Converts a mjml string to a html string

Input

Expects a json body
{
  "mjml": "<mjml><mj-body><mj-section><mj-column><mj-text>Hello World!</mj-text></mj-column></mj-section></mj-body></mjml>",
  "validationLevel": "skip"
}

Output · HTTP 200

Response
{
  "statusCode": 200
}
Show curl command
curl -X POST 'https://api.1001fx.com/data/mjml2html' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"mjml":"<mjml><mj-body><mj-section><mj-column><mj-text>Hello World!</mj-text></mj-column></mj-section></mj-body></mjml>","validationLevel":"skip"}'

Frequently asked questions

What is MJML?
A markup language for responsive emails. MJML templates are shorter than hand-written email HTML and render well in common email clients.
What happens with invalid MJML?
That depends on validationLevel: skip (default) renders without validation, soft validates and renders anyway, strict does not render if there is any error.

Try mjml2html now

Run it in your browser or create a free account and get 100 credits every month.

Changelog

  • 1.0.003.04.2023created
Ask 1001fx