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 API (EMAIL_ADAPTER=resend) — recommended for Railway
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
- Create a Resend account and verify your domain.
- Generate an API key in the Resend dashboard.
- Set:
EMAIL_ADAPTER=resend
RESEND_API_KEY=re_...
EMAIL_FROM=noreply@yourdomain.com # optional
EMAIL_FROM_NAME=Your App # optionalRESEND_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 AppDefaults: 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 AppSMTP-related env vars are optional when using the default Resend SMTP settings.
Environment variables
| Variable | Required | Description |
|---|---|---|
EMAIL_ADAPTER | Yes | resend (Resend REST API) or smtp (Nodemailer) |
RESEND_API_KEY | When resend | Required if EMAIL_ADAPTER=resend; used as SMTP password when smtp |
EMAIL_FROM | No | Default “from” address |
EMAIL_FROM_NAME | No | Default “from” name |
EMAIL_SMTP_HOST | No | SMTP host (default: smtp.resend.com) — only for smtp |
EMAIL_SMTP_PORT | No | SMTP port (default: 465) — only for smtp |
EMAIL_SMTP_USER | No | SMTP user (default: resend) — only for smtp |
EMAIL_SMTP_PASS | No | SMTP password — only for smtp |
Email templates
Email templates are built with @react-email/components:
| Template | Purpose |
|---|---|
| Newsletter welcome | Sent when someone subscribes to the newsletter. Includes the tenant’s site name and URL. |
| Welcome | Example template — not sent by any shipped flow. A starting point for your own onboarding email. |
| Test | Test 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:
- Edit the template component.
- Use components from
@react-email/components(e.g.Html,Head,Body,Text,Button,Img). - 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.