Skip to Content

Email

Email sending is controlled by EMAIL_ADAPTER: choose resend (Resend REST API) or smtp (Nodemailer / any SMTP). The app selects the adapter at startup based on this env var.

On Railway: use EMAIL_ADAPTER=resend. Railway blocks outbound SMTP on many plans; the Resend API uses HTTP and works without SMTP.

Resend  can be used via its REST API (no SMTP). This is the right choice when your host blocks SMTP (e.g. Railway Hobby/Free).

Setup

  1. Create a Resend account  and verify your domain.
  2. Generate an API key in the Resend dashboard.
  3. Set:
EMAIL_ADAPTER=resend RESEND_API_KEY=re_... EMAIL_FROM=noreply@yourdomain.com # optional EMAIL_FROM_NAME=Your App # optional

RESEND_API_KEY is required when EMAIL_ADAPTER=resend; the app will throw at startup if it is missing.

SMTP (EMAIL_ADAPTER=smtp)

With EMAIL_ADAPTER=smtp, Payload uses the Nodemailer adapter. By default it is configured for Resend’s SMTP server; you can point it at any SMTP provider.

Resend via SMTP (local / when SMTP is allowed)

EMAIL_ADAPTER=smtp RESEND_API_KEY=re_... EMAIL_FROM=noreply@yourdomain.com EMAIL_FROM_NAME=Your App

Defaults: host smtp.resend.com, port 465, user resend, password = RESEND_API_KEY.

Custom SMTP

To use another provider (Mailgun, SendGrid, Amazon SES, or your own server):

EMAIL_ADAPTER=smtp EMAIL_SMTP_HOST=smtp.your-provider.com EMAIL_SMTP_PORT=465 EMAIL_SMTP_USER=your-username EMAIL_SMTP_PASS=your-password EMAIL_FROM=noreply@yourdomain.com EMAIL_FROM_NAME=Your App

SMTP-related env vars are optional when using the default Resend SMTP settings.

Environment variables

VariableRequiredDescription
EMAIL_ADAPTERYesresend (Resend REST API) or smtp (Nodemailer)
RESEND_API_KEYWhen resendRequired if EMAIL_ADAPTER=resend; used as SMTP password when smtp
EMAIL_FROMNoDefault “from” address
EMAIL_FROM_NAMENoDefault “from” name
EMAIL_SMTP_HOSTNoSMTP host (default: smtp.resend.com) — only for smtp
EMAIL_SMTP_PORTNoSMTP port (default: 465) — only for smtp
EMAIL_SMTP_USERNoSMTP user (default: resend) — only for smtp
EMAIL_SMTP_PASSNoSMTP password — only for smtp

Email templates

Email templates are built with @react-email/components:

TemplatePurpose
Newsletter welcomeSent when someone subscribes to the newsletter. Includes the tenant’s site name and URL.
WelcomeExample template — not sent by any shipped flow. A starting point for your own onboarding email.
TestTest email for verifying SMTP configuration. Shows the configured SMTP host.

Templates share a wrapper for consistent layout and a button component for CTAs.

Customizing templates

Templates are standard React components rendered to HTML by @react-email/components. To customize:

  1. Edit the template component.
  2. Use components from @react-email/components (e.g. Html, Head, Body, Text, Button, Img).
  3. Preview with the React Email dev server  or by sending a test email via the admin.

Sending emails

Transactional emails render from React Email templates and send through the configured adapter. The “from” address and branding resolve from the tenant’s site email and site name, falling back to the EMAIL_FROM / EMAIL_FROM_NAME env vars.

Newsletter

The newsletter flow stores subscribers in the Subscribers collection (tenant-scoped) and sends a tenant-aware welcome email on signup — see Leads & Newsletter.