GuidesEmail

Sending Emails

This guide will help you learn how to send marketing emails using Resend in the Next.js Supabase SaaS template, covering setup and implementation details.

Overview

In the Next.js Supabase SaaS template, you can utilize the Resend mail provider to send marketing emails. This guide will walk you through the setup and implementation process.

Prerequisites

Before you begin, ensure that you have completed the following:

  1. Resend Account Setup: Create and configure your Resend account. You must have a valid Resend account to send emails.
  2. Email Template: Prepare your email template to be used in the invitation emails.

Sending Emails with Resend

To send marketing emails using Resend, you will use the resend.emails.send method. Follow the steps below for implementation:

Implementation

Use the following code snippet to send an email invitation:

const response = await resend.emails.send({
	from: `verify@${ServerConfiguration.env.RESEND_FROM_DOMAIN}`,
	to: emailTo,
	subject: "Invite From Team",
	react: InviteEmailTemplate({ inviteURL }),
});

Parameters Explained

  • from: The email address of the user (invitee), retrieved from the environment variable ServerConfiguration.env.RESEND_FROM_DOMAIN.
  • to: The email address of the user you want to invite, represented by the variable emailTo.
  • subject: The subject line of the email.
  • react: The content of the email, which should use an email template. Import the InviteEmailTemplate from the designated folder.

Additional Resources

For more information on creating and managing email templates, refer to the Email Templates documentation.

Summary

By following the steps outlined above, you can successfully send marketing emails using the Resend mail provider in your Next.js Supabase SaaS template.

On this page