> ## Documentation Index
> Fetch the complete documentation index at: https://nuntly.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Better Auth emails through Nuntly

> The Better Auth callbacks that send email verification, password reset, email change, email OTP and magic links, wired to the Nuntly SDK.

Better Auth never sends an email itself: each flow calls a function you provide. This page lists those callbacks and shows one wired to Nuntly. For every flow in a Next.js app, with the client calls, read the [Better Auth email guide](https://nuntly.com/blog/better-auth-email-verification-nextjs).

## Before you start

* The [Nuntly TypeScript SDK](https://nuntly.com/docs/api-reference/typescript-sdk.md): `npm install @nuntly/sdk`.
* An [API key](https://nuntly.com/docs/guides/api-keys.md) with send permission, in `NUNTLY_API_KEY`.
* A [verified sending domain](https://nuntly.com/docs/guides/sending-domains.md) for the `from` address. Until it is verified, every send fails with `domain_not_verified`.

## Callbacks

| Flow | Better Auth option |
| - | - |
| Email verification | `emailVerification.sendVerificationEmail` |
| Password reset | `emailAndPassword.sendResetPassword` |
| Email change | `user.changeEmail.sendChangeEmailConfirmation` |
| Email OTP | `emailOTP({ sendVerificationOTP })` |
| Magic link | `magicLink({ sendMagicLink })` |
| Account deletion | `user.deleteUser.sendDeleteAccountVerification` |
| Two-factor code | `twoFactor({ otpOptions: { sendOTP } })` |
| Organization invitation | `organization({ sendInvitationEmail })` |

These are the 8 email callbacks of `better-auth` 1.7.25. The [Better Auth email guide](https://nuntly.com/blog/better-auth-email-verification-nextjs) wires the first five and checks them against 1.6.20 and 1.7.25.

## Send with the Nuntly SDK

Every callback can call one `sendEmail` function. Email verification looks like this:

```typescript theme={null}
// lib/auth.ts
import { betterAuth } from 'better-auth';
import { after } from 'next/server';
import { Nuntly } from '@nuntly/sdk';

const nuntly = new Nuntly({ apiKey: process.env.NUNTLY_API_KEY });

async function sendEmail({ to, subject, text, flow }: { to: string; subject: string; text: string; flow: string }) {
  await nuntly.emails.send({
    from: 'Acme <auth@mail.example.com>',
    to,
    subject,
    text,
    tags: [{ name: 'flow', value: flow }],
  });
}

export const auth = betterAuth({
  advanced: {
    backgroundTasks: { handler: after },
  },
  emailAndPassword: {
    enabled: true,
    requireEmailVerification: true,
  },
  emailVerification: {
    sendOnSignUp: true,
    sendVerificationEmail: async ({ user, url }) => {
      await sendEmail({ to: user.email, subject: 'Verify your email address', text: `Confirm your address: ${url}`, flow: 'email-verification' });
    },
  },
});
```

The `flow` tag shows on each email's page in the Nuntly dashboard and in its webhook events.

`advanced.backgroundTasks.handler` lets Better Auth respond before the send finishes, so response times don't reveal which accounts exist. Better Auth's [email docs](https://better-auth.com/docs/concepts/email) (read on November 15, 2026) advise against awaiting the send. In Next.js the handler is [`after`](https://nextjs.org/docs/app/api-reference/functions/after). `sendMagicLink` and the resend endpoint behind `authClient.sendVerificationEmail` stay awaited whatever the handler ([Run the send in the background](https://nuntly.com/blog/better-auth-email-verification-nextjs#run-the-send-in-the-background)).

## Better Email plugin

[Better Email](https://nuntly.com/docs/guides/better-email-for-better-auth.md) is an open-source Better Auth plugin that replaces these callbacks with one provider and one template renderer. In version 1.0.1:

* It registers the email verification and password reset callbacks itself.
* For email change and magic link, pass `email.helpers.changeEmail` to `sendChangeEmailConfirmation` and `email.helpers.magicLink` to `sendMagicLink`.
* For email OTP, keep your own `sendVerificationOTP` callback: the plugin's OTP helper doesn't accept the `change-email` type that Better Auth 1.6 and 1.7 send.

## Learn more

> [card] [Better Auth email guide](https://nuntly.com/blog/better-auth-email-verification-nextjs)
>
> Email verification, password reset, email change, email OTP and magic links in Next.js

> [card] [Better Email plugin](https://nuntly.com/docs/guides/better-email-for-better-auth.md)
>
> One provider and one renderer for every Better Auth email


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.