Skip to main content

Quick start

If you use the standalone EmailEditor component, you can access the email HTML and plain text through ref methods.
The ref exposes three export methods:
MethodReturnsDescription
getEmailHTML()Promise<string>Email-ready HTML
getEmailText()Promise<string>Plain text version
getEmail()Promise<{ html, text }>Both in a single call
All three use composeReactEmail under the hood.

Using without EmailEditor

Use composeReactEmail directly to convert editor content into email-ready HTML and plain text without EmailEditor.

How it works

The composeReactEmail function follows this pipeline:
  1. Read the editor’s JSON document
  2. Traverse each node and mark in the document tree
  3. Call renderToReactEmail() on each EmailNode and EmailMark extension
  4. Apply theme styles via the SerializerPlugin (if EmailTheming is configured)
  5. Wrap the content in a BaseTemplate component
  6. Renders to an HTML string and plain text version using render
The return value is:

Preview text

The preview parameter sets the email preview text. Email preview text is the snippet shown in inbox list views before the email is opened.
Pass null to omit preview text.

Using with theming

When the EmailTheming extension is in your extensions array, theme styles are automatically injected into the exported HTML. The serializer uses the SerializerPlugin provided by EmailTheming to resolve styles for each node based on the current theme and depth in the document tree.

Full example with export panel

Here’s a complete editor with theming and an export panel.

Examples

See email export in action with runnable examples:

Email Export

Export editor content to themed HTML.

Full Email Builder

Complete editor with theming, menus, and export.