---
title: "composeReactEmail"
sidebarTitle: "composeReactEmail"
description: "Convert editor content to email-ready HTML and plain text."
icon: "file-export"
---
The `composeReactEmail` function is the core of the editor's email export system. It takes
the editor's document tree, walks every node and mark, calls each extension's
`renderToReactEmail()` method, applies theme styles, wraps everything in an email-ready
template, and produces both HTML and plain text output.
## Import
```tsx
import { composeReactEmail } from '@react-email/editor/core';
```
## Signature
```tsx
async function composeReactEmail(params: {
editor: Editor;
preview?: string;
previewMode?: boolean;
pretty?: boolean;
}): Promise<{ html: string; text: string; unformattedHtml: string }>;
```
## Parameters
The TipTap editor instance. The function reads the editor's JSON document and walks through
each registered extension to serialize nodes and marks.
Preview text shown in inbox list views before the email is opened. Leave it out to omit
preview text.
Leaves out the dark-mode `