Export HTML

Trigger Event #

Now that the editor is set up in your application and users are creating content, it's time to save the resulting HTML. Here's how you can export the design's HTML.
mailui.exportHtml(function (data) { const json = data.json; const html = data.html; console.log(json, html); });

Pass Export Options #

You can also provide specific options to this function as an additional argument. View all options.
mailui.exportHtml(function (data) { const json = data.json; const html = data.html; console.log(json, html); }, { minify: true, mergeTags: { first_name: "John", last_name: "Author", } });

Callback Parameters #

PropertyDescriptionType
jsonThis is the JSON of the designJSON
htmlThis is the HTML string of the designstring

Export Options #

PropertyRequiredDescriptionTypeDefault
ampNoIt optimizes the content to load faster on mobile devices.
{
    amp: false;
}
Booleanfalse
minifyNoThe minify option reduces the size of the exported code by removing unnecessary spaces, line breaks, and comments.
{
    minify: false;
}
Booleanfalse
mergeTagsNomergeTags allows dynamic content to be injected based on specified variables or data tags within the project.
{
    mergeTags: {
      first_name: "John",
      last_name: "Author",
    }
}
Object
displayConditionsNodisplayCondition allows you to set rules for when and how certain elements or content are displayed, based on conditions like user behavior.
{
    displayConditions: {
      ismen: true,
      iswomen: false,
      ischild: false,
    }
}
Object

Explore Our Email Builder