email dev

Starts a local development server that will watch your files and automatically rebuild your email template when you make changes.

Options

--dir
string
default: "emails"

Change the directory of your email templates.

--port
string
default: "3000"

Port to run dev server on

F.A.Q

email build

Copies the preview app for onto .react-email and builds it.

--dir
string
default: "emails"

Change the directory of your email templates.

--packageManager
string
default: "npm"

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

--outDir
string
default: "out"

Change the output directory.

--pretty
boolean
default: "false"

Minify or prettify the generated HTML file.

--plainText
boolean
default: "false"

Set output format as plain text.

--dir
string
default: "emails"

Change the directory of your email templates.

email help <cmd>

Shows all the options for a specific command.