Send transactional emails with Resend

To get a Resend API key and set up your domain for email sending, follow the Resend documentation here.

To use the Resend integration to send transactional emails 1 environment variable is required:

Once you configured this API key as an environment variable you can use the two functions to either send plain text emails or React template emails.

To send plain text emails use the following function:

import { sendPlainTextMail } from '@/utils/emails/resend'

await sendPlainTextMail(
  'to-email@test.com',                        // to email address
  'from-email@test.com',                      // from email address - usually an email address from your company
  'Subject of email',                         // email subject
  'Email body - hey this is a test email',    // plain text body of email
  [{ name: 'tag-name', value: 'tag-value' }]  // optional tags
)

To send an email using a React component as a template use the following function:

import { sendDemoReactEmail } from '@/utils/emails/resend'

await sendDemoReactEmail(
  'to-email@test.com',                        // to email address
  'from-email@test.com',                      // from email address - usually an email address from your company
  'Subject of email',                         // email subject
  ... React component props used to populate template
)
Last updated:

Want to know how to easily build your SaaS?

Sign up for the Ship SaaS newsletter to get notifiedabout the latest updates and blog posts

We care about the protection of your data. Read our Privacy Policy and Terms & Conditions.