CLI
After installing the React Email package (or cloning a starter), you can start using the command line interface (CLI).
email dev
Starts a local development server that will watch your files and automatically rebuild your email template when you make changes.
Options
Change the directory of your email templates.
Port to run dev server on
F.A.Q
email build
Copies the preview app for onto .react-email
and builds it.
Change the directory of your email templates.
Package manager to use on the installation of .react-email
.
email start
Runs the built preview app that is inside .react-email
.
email export
Generates the plain HTML files of your emails into a out
directory.
A very common misconception is to assume that email export
is the default or primary way of rendering
email templates.
The primary and preferable way is always going to be the render utility, by passing in the needed data through props, on the exact moment of sending the email.
email export
is a secondary way meant for situations where React Email cannot be used optimally.
With this secondary way, comes significant drawbacks, mainly the need for manual templating, which
could be done easily with the render
utility. It being a secondary way, we would strongly recommend
you donβt use it unless you really are forced into it.
As an example, two cases where email export
makes itself necessary include:
- When the email content must be processed by a backend in a language other than JavaScript.
- When the platform handling email, such as Shopify, forces you into manual templating.
You also should not have to worry about render
βs performance, as typically, the introduced
time in rendering is going to be milliseconds when compared to manual templating.
Options
Change the output directory.
Minify or prettify the generated HTML file.
Set output format as plain text.
Change the directory of your email templates.
email help <cmd>
Shows all the options for a specific command.