Docs
Email

Email

How to manage emails in this project.

The magic-link feature with Resend works with Auth.js v5!
You can use it in your local environment and in your own production setup.

However, you can't test it on this demo app because I don't want to use the premium Resend plan for this demo.

Steps

The email part is similar at the resend documentation. You can find the official documentation here if you want.

Create an account

If don't have an account on Resend, just follow their steps after signup here.

Create an API key

After sign-in on Resend, it prompts you to create your first API key.

Copy/paste in your .env file.

RESEND_API_KEY=re_your_resend_api_key
EMAIL_FROM=login@your-domain.com

How it works in this repo

  • Email provider is wired via auth.config.ts using Resend (not enabled on Edge runtime).
  • Magic link emails are rendered with react-email in emails/magic-link-email.tsx and sent by lib/email.ts’s sendVerificationRequest.
  • EMAIL_FROM is used as the sender address.

Note: To preview email templates locally, run pnpm email (Resend preview server). If you hit a renderToReadableStream error, see the React Email issue thread for updating the .react-email folder.