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.When running on 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,
and 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.The
plainText
option in the render
function is deprecated since @react-email/render@1.2.0. Use the toPlainText
function instead.Options
Beautify HTML output
Generate plain text version