This guide covers customizing Supabase Auth emails (sign up verification, magic link, password reset), connecting Resend for SMTP delivery, and applying deliverability best practices.
Overview
Supabase Auth sends three types of emails:| Email Type | Trigger | Purpose | Default Template |
|---|---|---|---|
| Confirmation Email | User signs up with email/password | Verify email address before first sign-in | Signup confirmation |
| Magic Link | User chooses passwordless sign-in | One-click authentication without password | Magic link |
| Password Reset | User clicks “Forgot password” | Secure password reset via email link | Reset password |
Prerequisites
- Supabase project with Authentication enabled
- (Recommended) Resend account with verified domain (SPF/DKIM/DMARC)
1
Configure URLs (Supabase)
Go to Supabase → Authentication → Configuration → URL Configuration and set:
- Site URL (per environment)
- Additional Redirect URLs: include
/auth/callbackfor dev/preview/prod domains
Auth links in emails redirect to your app and complete the callback flow.
2
Connect Resend (SMTP)
Two options:
- Option A: Use Supabase Integrations to connect Resend (auto SMTP configuration)
- Option B: Get SMTP credentials from Resend and set them under Supabase → Authentication → Emails → SMTP Settings
Test emails from Supabase are delivered through Resend with your domain as sender.
3
Edit email templates (Supabase)
Go to Supabase → Authentication → Emails → Templates to edit subject, sender, and body for each email type.
Available Templates
| Template | When Sent | Customizable Fields | Template Variables |
|---|---|---|---|
| Confirm signup | After email/password sign-up | Subject, Sender, HTML Body | {{ .ConfirmationURL }}, {{ .SiteURL }}, {{ .Token }} |
| Magic link | User requests passwordless sign-in | Subject, Sender, HTML Body | {{ .ConfirmationURL }}, {{ .SiteURL }}, {{ .Token }} |
| Change email address | User updates email in settings | Subject, Sender, HTML Body | {{ .ConfirmationURL }}, {{ .SiteURL }}, {{ .Token }} |
| Reset password | User clicks “Forgot password” | Subject, Sender, HTML Body | {{ .ConfirmationURL }}, {{ .SiteURL }}, {{ .Token }} |
Template Variables
Each email template has access to these variables:Example: Custom Magic Link Template
Security scanner prefetch protection:Some corporate email security scanners automatically “click” links in emails to check for malware. This can consume one-time magic links before users click them.Solution: Implement an intermediate landing page:
- Instead of direct magic link:
https://yourapp.com/auth/callback?token_hash=... - Use intermediate page:
https://yourapp.com/auth/verify?token=... - Show “Click to continue” button on intermediate page
- Button then redirects to actual
/auth/callbackwith token
Test each template by:
- Triggering the email flow (sign up, magic link, password reset)
- Checking inbox for email (also check spam)
- Verifying links work correctly
- Testing on multiple email clients (Gmail, Outlook, Apple Mail)
4
Deliverability best practices
- Match the sender domain and link domain (use a custom domain)
- Use a dedicated subdomain for auth emails (e.g.,
auth.yourdomain.com) - Disable tracking on Auth emails
- Configure DMARC alongside SPF/DKIM
- Mitigate link scanners with an intermediate page pattern
Emails land in inbox (not spam) for Gmail/Outlook; links function reliably.
5
End‑to‑end testing
Test all three email flows to ensure everything works:
1. Confirmation Email Test
- Sign Up Flow
- Email Not Received?
- Go to
/sign-up - Enter name and email
- Choose “Create password” option
- Submit form
- Expected: Confirmation email arrives
- Click link in email
- Expected: Redirected to
/dashboard - Verify you can sign in
2. Magic Link Test
- Magic Link Flow
- Link Not Working?
- Go to
/sign-in - Enter email
- Click “Send magic link” button
- Expected: Magic link email arrives
- Click link in email
- Expected: Redirected to
/dashboard - Verify you’re signed in
3. Password Reset Test
- Reset Flow
- Reset Issues?
- Go to
/forgot-password - Enter email
- Submit form
- Expected: Redirected to
/sign-in?reset=true - Expected: Reset email arrives
- Click link in email
- Expected: Redirected to
/reset-password - Enter new password
- Submit form
- Expected: Redirected to
/sign-in - Sign in with new password
Testing Checklist
- Confirmation email arrives within 1 minute
- Email renders correctly in Gmail
- Email renders correctly in Outlook
- Email renders correctly in Apple Mail
- Links work when clicked
- Links work on mobile devices
- Expired links show appropriate error
- Used links show appropriate error
- Emails don’t land in spam (after Resend setup)
- Dark mode email templates look good (if using)
Email Flow Diagrams
Sign-Up Confirmation Flow
Magic Link Flow
Password Reset Flow
Troubleshooting
Emails not arriving
Emails not arriving
Cause: Rate limiting, spam filters, or SMTP misconfiguration.Fix:
-
Check rate limits:
- Supabase free tier: 4 emails/hour during development
- Production: Unlimited with verified domain
- Upgrade plan or wait for rate limit reset
-
Check spam folder:
- Auth emails often land in spam initially
- Use custom domain (not @resend.dev) to improve deliverability
-
Verify SMTP configuration:
- Supabase Dashboard → Auth → Emails → SMTP Settings
- Test connection with “Send test email” button
- Check Resend dashboard for delivery errors
-
Check Supabase logs:
- Dashboard → Logs → Auth Logs
- Look for email send errors
- Common error: “Email rate limit exceeded”
Links not working or showing 'auth_failed'
Links not working or showing 'auth_failed'
Cause: Expired links, already-used links, or tracking interference.Fix:
-
Check link expiration:
- Magic links: 1 hour (default)
- Reset links: 1 hour (default)
- Request new link if expired
-
Verify link hasn’t been used:
- Auth links are one-time use
- Already-clicked links show “auth_failed”
- Request new link
-
Disable email tracking:
- Resend → Settings → Tracking → Disable
- Link tracking rewrites URLs and breaks auth
-
Check for security scanner prefetch:
- Corporate emails may “click” links automatically
- Implement intermediate landing page pattern
Emails landing in spam
Emails landing in spam
Cause: Poor sender reputation, no SPF/DKIM, or suspicious content.Fix:
-
Verify your domain in Resend:
-
Use custom domain:
- Change from:
[email protected] - To:
[email protected]or[email protected]
- Change from:
-
Improve email content:
- Remove spammy words (“urgent”, “verify now”, excessive caps)
- Use clear, professional language
- Include your company logo and branding
-
Warm up your domain:
- Start with low email volume
- Gradually increase over days/weeks
- Monitor spam rates in Resend dashboard
Custom domain not working
Custom domain not working
Cause: DNS records not propagated or incorrectly configured.Fix:
-
Verify DNS records:
-
Wait for propagation:
- DNS changes can take 24-48 hours
- Use whatsmydns.net to check global propagation
-
Verify in Resend dashboard:
- Resend → Domains → Your domain should show “Verified”
- If not, re-check DNS records match Resend’s requirements
-
Test email sending:
- Resend → Domains → “Send test email”
- Check delivery to Gmail, Outlook, Yahoo
Email templates not rendering correctly
Email templates not rendering correctly
Cause: HTML/CSS compatibility issues across email clients.Fix:
-
Use email-safe HTML:
- Tables for layout (not CSS Grid/Flexbox)
- Inline CSS (not external stylesheets)
- Absolute URLs for images (not relative paths)
-
Test across clients:
- Litmus for email testing
- Email on Acid for preview
- Test manually in Gmail, Outlook, Apple Mail
-
Use Resend’s template testing:
- Resend → Templates → Preview
- Send test emails to yourself
- Check rendering on mobile devices
-
Simplify complex layouts:
- Email clients have limited HTML/CSS support
- Keep layouts simple and table-based
- Use web-safe fonts (Arial, Helvetica, Georgia)
Production Checklist
Before going live, ensure:- Custom domain verified in Resend (SPF/DKIM/DMARC configured)
- Email templates customized with your branding
- All template variables working correctly
- Link tracking disabled for auth emails
- Sender address uses your custom domain (
[email protected]) - Tested all three flows (confirmation, magic link, reset) end-to-end
- Emails arrive within 1 minute
- Emails don’t land in spam for Gmail/Outlook/Yahoo
- Mobile email rendering tested
- Dark mode email templates tested (if applicable)
- Rate limits increased for production (Supabase plan upgrade)
- Monitoring set up in Resend dashboard (delivery, bounces, complaints)
Related Documentation
Auth with Supabase
Complete authentication setup including sign-in, sign-up, OAuth, and password reset flows.
Environment Variables
Configure Supabase and Resend environment variables for local and production.
API Reference: Auth Callback
Detailed documentation for the
/auth/callback endpoint that handles email verification.Resend Docs
Official Resend documentation for advanced email configuration and troubleshooting.
References
- Supabase Dashboard (Auth → Emails → Templates): Open Dashboard
- Supabase × Resend Integration: Integration
- Deliverability guide: Resend Knowledge Base
- DNS Record Checker: WhatsmyDNS
- Email Testing Tools: Litmus, Email on Acid