Export plain text
ExportExport plain text
A text/plain alternative part for a multipart email.
ts
ref.current.editor.exportPlainText((data) => data.text);
// server: renderPlainText(design) // from email-craft-sdkWhat the text contains
The text is made from the same render as the HTML export, then reduced to its words:
- Headings, paragraphs and table rows end a line, a
<br>is a line break, and each list item starts with-. - Outlook-only copies (the VML button, ghost tables) are removed first, so a button label appears once.
- Tags are removed with their attributes, so link addresses and image alt text are not in the output. Only visible text is.
- Three or more line breaks collapse into one blank line, and HTML entities are decoded.
Merge tags and options
On the server, renderPlainText(design, options) takes mergeTags, locale and sanitize. Tags you give a value are filled in; any other {{tag}} stays as written for your sending platform. A design still in Unlayer's JSON is converted first.
In the browser, the callback gets { design, text }, and without a callback the call returns a promise of the same object. The mergeTags export option there fills the HTML only, so fill tags in the text on your server. The same text is the email.txt file in a ZIP export.