Export Plain Text

Similar to export HTML function, you can also export a design in plain text. This is useful if you want to send an email in multiple formats for different email clients.

unlayer.exportPlainText(function(data) {
  var json = data.design; // design json
  var text = data.text; // final text

  // Do something with the json and text
})

Callback Parameters

The exportPlainText callback returns the following parameters.

Name

Description

design

This is the JSON of the design

text

This is the full plain text of the design


Additional Parameters

You can pass additional parameters to configure which parts of the design you want to omit in the plain text. For example, you can choose to ignore images, links or preheader text.

unlayer.exportPlainText(function(data) {
  var json = data.design;
  var text = data.text;
}, {
  ignoreLinks: true,
  ignoreImages: true,
  ignorePreheader: true
})

Name

Description

ignoreLinks

Links and buttons will not be included

ignoreImages

Image alt text will not be included

ignorePreheader

Pre-header text for emails will not be included.


Did this page help you?