Documentation
React Email templates
Build TSX templates with @react-email/components and use renderPreview to preview with variables in real time.
1. Install dependencies
Add @react-email/components to your project. Components are compatible with Node 18+.
bashbash
2. Create a TSX template
Write your template as a React component. Use dynamic variables as props — they will be substituted at send time.
templates/WelcomeEmail.tsx
3. Submit the HTML to CoffeeMail
Render the component with @react-email/render and POST to /v1/product/templates with format=react_email.
compile-and-save.ts
4. Render preview
Use renderPreview to validate visually without sending — useful in the dashboard playground.
preview.ts
5. Use variables when sending
At send time, pass the variables object with the prop values. Missing variables fall back to the defaultValue registered in the template.
send.ts
The format: 'react' is rendered server-side by CoffeeMail from the HTML generated by @react-email/render — there is no JS bundle overhead in the sent email. The subject supports Handlebars ({name}) and is interpolated at send time.