Overview
Featul uses Resend as the email service provider for:- Email verification (OTP codes)
- Welcome emails
- Password reset emails
- Workspace invitations
- Reservation confirmations
- Report notifications
Resend Setup
1. Create Resend Account
- Sign up at Resend
- Verify your email address
- Add and verify your sending domain
2. Domain Verification
- Go to Resend Dashboard > Domains
- Add your domain (e.g.,
featul.com) - Add the provided DNS records:
- SPF record (TXT)
- DKIM record (TXT)
- DMARC record (TXT)
- Wait for verification (usually a few minutes)
For development, you can use Resend’s test mode which allows sending to verified email addresses without domain verification.
3. Generate API Key
- Go to Resend Dashboard > API Keys
- Create a new API key with sending permissions
- Copy the API key (you won’t be able to see it again)
4. Environment Variables
Add these to your.env file:
.env
RESEND_API_KEY: Your Resend API keyRESEND_FROM: The “From” address and name for outgoing emails
packages/auth/src/email/transport.ts:9-10
Email Types
Welcome Email
Sent automatically when a new user signs up:packages/auth/src/email.ts:10-13
Triggered by: packages/auth/src/auth.ts:252-261
Email Verification (OTP)
Sent for:- Email verification during sign-up
- Sign-in verification (if enabled)
- Password reset
packages/auth/src/email.ts:15-19
Triggered by: packages/auth/src/auth.ts:232-237
OTP codes are 6-digit numeric codes that expire after a short time (configured in better-auth).
Workspace Invitation
Sent when a user is invited to join a workspace:packages/auth/src/email.ts:21-25
Reservation Email
Sent to confirm workspace subdomain reservations:packages/auth/src/email.ts:27-31
Report Email
Sent when content is reported:packages/auth/src/email.ts:32-36
Email Transport
The email transport implementation uses the Resend API:packages/auth/src/email/transport.ts:8-34
Development Mode
IfRESEND_API_KEY is not set, emails will be logged to the console instead:
packages/auth/src/email/transport.ts:12-15
In test mode (non-production with invalid credentials), failed emails will log warnings instead of throwing errors.
Email Templates
Email templates are React components rendered to HTML:welcomeemail.tsx: Welcome email templateverifyemail.tsx: OTP verification email templateinviteemail.tsx: Workspace invitation templatereserveemail.tsx: Reservation confirmation templatereportemail.tsx: Report notification template
packages/auth/src/email/
Email Rendering
Emails are rendered with both HTML and plain text versions:Rate Limiting
Email sending is indirectly rate-limited through authentication endpoint rate limits:- Email verification: 5 requests per 60 seconds
- Password reset: 3 requests per 5 minutes
packages/auth/src/auth.ts:219-221
See the Authentication Configuration page for rate limit setup.
Alternative Email Providers
To use a different email provider (SendGrid, Mailgun, etc.):- Modify
packages/auth/src/email/transport.ts - Replace the Resend API call with your provider’s API
- Update environment variables accordingly