ZTS Docs
Email/Integrations

Resend Integration

How the Resend email service is integrated for sending transactional emails.

Resend Integration

This document explains how the Resend email service is integrated for sending transactional emails.

Configuration

  1. Provider Selection: To use Resend, the NEXT_PUBLIC_EMAIL_PROVIDER environment variable must be set to "resend". This can be done via the configuration UI (/configure) or directly in the .env file.

  2. API Key: The RESEND_API_KEY environment variable must contain a valid API key obtained from your Resend account.

How it Works

When NEXT_PUBLIC_EMAIL_PROVIDER is set to "resend", the core email router calls the Resend-specific sending logic located in src/server/email/send-email-resend.ts.

This logic:

  • Uses the official resend SDK.
  • Checks if RESEND_API_KEY is configured (isResendConfigured).
  • Takes a payload (EmailPayload) containing to, subject, from, and either react (a React Email component) or text.
  • Renders React components to HTML using @react-email/render.
  • Handles both single recipient sends (resend.emails.send) and batch sends (resend.batch.send) if to is an array.
  • Includes error handling and logging for API responses.

Usage Examples

When Resend is configured as the provider, it's used by the core sendEmail function for actions like:

  • Sending email verification links.
  • Sending password reset links.
  • Sending email change confirmations (if enabled).

Considerations

  • Pricing and Limits: Resend offers various plans including a free tier with limitations. Refer to the official Resend Pricing for details.
  • Daily Sending Limit: Be aware of potential sending limits, especially on the free tier. See the General Email Configuration for discussion and mitigation strategies.
  • Domains: Configure sending domains within your Resend account dashboard.
  • Data Retention: Check your Resend plan for details on email log retention periods.

On this page