Skip to main content

1. Install dependencies

Install package from your command line.

2. Create an email using React

Start by building your email template in a .jsx or .tsx file.
email.jsx

3. Convert to HTML

Import an existing React component and convert into a HTML string.
You can use the pretty function to beautify the output.
This will generate the following output:
When running in the browser, to properly support Safari and browsers running on iOS, you will need to polyfill the ReadableByteStreamController API.We recommend npm i web-streams-polyfill. It can be applied as follows in some sort of root file for your website:

4. Convert to Plain Text

Plain text versions of emails are important because they ensure that the message can be read by the recipient even if they are unable to view the HTML version of the email. This is important because not all email clients and devices can display HTML email, and some recipients may have chosen to disable HTML email for security or accessibility reasons. Here’s how to convert a React component into plain text.
This will generate the following output:

Options

pretty
boolean
Beautify HTML output
plainText
boolean
Generate plain text version
htmlToTextOptions
HtmlToTextOptions
html-to-text options used for rendering