Skip to main content

Overview

This example demonstrates how to use Trigger.dev to send emails using React Email.
This example uses Resend as the email provider. You can use other email providers like Loops or SendGrid etc. Full list of their integrations can be found here.

Task code

This email is built using React components. To use React components in your task, it must be a .tsx file.
trigger/sendReactEmail.tsx

The email

This example email should look like this: React Email This is just a simple implementation, you can customize the email to be as complex as you want. Check out the React email templates for more inspiration.

Testing your task

To test this task in the dashboard, you can use the following payload:

Deploying your task

Deploy the task to production using the Trigger.dev CLI deploy command.

Using Cursor / AI to build your emails

In this video you can see how we use Cursor to build a welcome email. We recommend using our Cursor rules to help you build your tasks and emails.

Video: creating a new email template using Cursor

The generated email template

Cursor

The generated code

emails/trigger-welcome-email.tsx
And then to trigger the email, you can use the following task:
trigger/triggerWelcomeEmail.tsx

Troubleshooting

If you see this error when using react-email packages:
See our common problems guide for more information.

Learn more

React Email docs

Check out the React Email docs and learn how to set up and use React Email, including how to preview your emails locally.

Components

Pre-built components you can copy and paste into your emails.

Templates

Extensive pre-built templates ready to use.