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 this command is the way meant to be used to send the email templates, but it is not.
The preferable way is to render the email using the render utility,
by passing in the needed data through props, on the moment of sending the email,
This gives for a much better developer experience that it would with email export
.
email export
is a secondary way where the situation is not optimal. Two of them are:
- The email template is sent through some other language
- You are going to use separate templating, because the email platform you use forces you to do so
We strongly recommend users to gravitate towards using the preferable way, because otherwise you will end up having to fight a lot with the rendered markup and many other issues arise.
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.