Auth.js (NextAuth) email provider with Notify
Auth.js magic link and email sign-in with Notify — override sendVerificationRequest on the Nodemailer provider, POST to Notify with x-api-key, no SMTP.
Short answer: Auth.js email sign-in (magic links) uses the Nodemailer provider (next-auth/providers/nodemailer). Override sendVerificationRequest with a fetch (or notifycx) call to POST https://notify.cx/api/email/send and header x-api-key — the same HTTP pattern as Auth.js’s Resend provider built-in sendVerificationRequest, without SMTP. You still need a database adapter for verification tokens (Nodemailer overview). See also Magic links & OTP with Notify.
Notify is transactional send only — no SMTP. Auth.js does not deliver mail for you; you implement delivery in sendVerificationRequest.
Related: Better Auth → Notify · Auth verification recipe
Prerequisites
- Notify API key (
NOTIFY_API_KEYon the server) - Verified domain for production
from(sandbox vs production) - Auth.js / NextAuth v5 with a database adapter (required for email sign-in — Nodemailer provider)
AUTH_SECRET— generate withnpx auth secret(installation)
npm install next-auth
# notifycx optional
npm install notifycx
You do not need the nodemailer package if you fully replace sendVerificationRequest and never use the default SMTP transport.
Provider import (Auth.js v5, Nov 2026)
Email magic-link sign-in uses:
import Nodemailer from 'next-auth/providers/nodemailer';
(SvelteKit: import Nodemailer from '@auth/sveltekit/providers/nodemailer' — same provider docs.)
Auth.js documents customization on Nodemailer({ sendVerificationRequest(...) }) with parameters identifier, url, and provider (customization). The Resend provider documents the same callback shape with an additional theme argument (Resend customization).
Shared Notify send helper
// lib/notify-mail.ts
export async function sendMagicLinkEmail(opts: {
to: string;
from: string;
subject: string;
html: string;
}) {
const res = await fetch('https://notify.cx/api/email/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.NOTIFY_API_KEY!
},
body: JSON.stringify({
to: opts.to,
from: opts.from,
subject: opts.subject,
html: opts.html
})
});
if (!res.ok) {
throw new Error(`Notify send failed: ${await res.text()}`);
}
}
Next.js App Router (auth.ts)
Match Auth.js installation for your framework. Example for Next.js:
// auth.ts
import NextAuth from 'next-auth';
import Nodemailer from 'next-auth/providers/nodemailer';
import { sendMagicLinkEmail } from './lib/notify-mail';
const from =
process.env.EMAIL_FROM ?? 'Auth <noreply@your-verified-domain.com>';
export const { handlers, signIn, signOut, auth } = NextAuth({
adapter: /* your database adapter */,
providers: [
Nodemailer({
from,
async sendVerificationRequest({ identifier, url, provider }) {
const { host } = new URL(url);
await sendMagicLinkEmail({
to: identifier,
from: provider.from ?? from,
subject: `Sign in to ${host}`,
html: `<p><a href="${url}">Sign in to ${host}</a></p><p>If you did not request this email, you can safely ignore it.</p>`
});
}
})
]
});
Wire route handlers at app/api/auth/[...nextauth]/route.ts per installation.
Optional: richer HTML
Reuse the table-style HTML from Auth.js’s built-in sendVerificationRequest example; replace the fetch("https://api.resend.com/emails", …) block with sendMagicLinkEmail (or notifycx).
sendVerificationRequest contract
| Param | Meaning |
|---|---|
identifier | Recipient email address (normalized by Auth.js) |
url | Magic link URL containing the verification token |
provider | Provider config (from, and server for Nodemailer) |
theme | Optional theme colors (documented on Resend provider) |
If send throws, Auth.js surfaces sign-in errors — log failures server-side and monitor Notify logs.
Database adapter
Email sign-in stores verification tokens in your database. Configure a supported adapter before enabling the Nodemailer provider. JWT-only sessions without a database cannot use email sign-in (Nodemailer overview).
Production checklist
- Set
NOTIFY_API_KEYandEMAIL_FROMin server env only - Verify domain for
EMAIL_FROM - Test sign-in at
/api/auth/signin(Nodemailer configuration) - Optional (Pro+): webhooks for bounces
Related docs
FAQ
Is this the old “Email” provider?
In Auth.js v5 the magic-link email provider is documented as Nodemailer. For HTTP APIs like Notify, Auth.js points you at providers such as Resend or a custom sendVerificationRequest on Nodemailer — which is what this guide uses.
Do I need SMTP or the nodemailer npm package?
No, when you fully override sendVerificationRequest and call Notify’s HTTP API. Do not set a real EMAIL_SERVER unless you want the default SMTP path.
Can I use NextAuth v4 / pages/api/auth?
This page targets Auth.js v5 (NextAuth() from next-auth). Older NextAuth v4 email flows often used SMTP or custom providers; migrate to v5 patterns above for sendVerificationRequest.
Bearer token or x-api-key?
Notify uses x-api-key only. Do not send Authorization: Bearer.
Why was production from rejected?
Accounts start sandbox_only. Verify your domain before using a custom from on that domain (Sandbox vs production).
Next step
- Sign up and copy a server-side
NOTIFY_API_KEY. - Add
sendVerificationRequestonNodemailerin your Auth.js config. - Verify your domain, then test magic-link sign-in.