Sending email
Send transactional email through Resend, and see emails in your terminal while developing.
All email goes through sendEmail() in src/lib/email.ts.
How it behaves
| Situation | What happens |
|---|---|
RESEND_API_KEY set | Sent through Resend from EMAIL_FROM |
| No key, local development | Printed in the terminal running npm run dev, with the full text and any links |
| No key, production | Throws Missing environment variable RESEND_API_KEY. (and email sign-in is hidden) |
A printed email looks like this:
[email] to=you@example.com subject="Confirm your email for Acme"
Welcome to Acme! Confirm your email address to finish signing up.
Confirm email: http://localhost:3000/api/auth/verify-email?token=…Emails the kit sends
- Email confirmation after sign-up (and again when signing in unconfirmed)
- Password reset
- "You already have an account" when someone signs up again with an existing email
Send your own
A one-button email (like confirmation and reset):
import { actionEmail, sendEmail } from '@/lib/email';
await sendEmail(
actionEmail({
to: user.email,
subject: 'Your report is ready',
intro: 'Your monthly report has finished generating.',
cta: 'View report',
url: `${siteConfig.url}/dashboard/reports`,
}),
);Or any email:
await sendEmail({ to, subject, html, text });Always include text as well as html. Some email apps show only text, and it helps deliverability.
The sender address
EMAIL_FROM sets the sender, for example "Your Product <hello@yourdomain.com>". The domain must be verified in Resend. Without EMAIL_FROM, the kit sends from onboarding@resend.dev, Resend's testing address, which can only deliver to your own Resend account's email.
Problems
See Email errors.