Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Better Auth · Module

sendVerificationEmail

sendVerificationEmail is the Better Auth callback used to deliver an email-verification link. Configure it under emailVerification; Better Auth provides the recipient, URL, token, and request context.

How it works

Configure emailVerification.sendVerificationEmail with an async callback. Better Auth supplies the user, verification URL, and token when verification begins; the callback passes the URL to your email service. The client can also request another verification email explicitly.

Syntax

sendVerificationEmail: async ({ user, url, token }, request) => { /* send email */ }

Parameters

NameTypeDescription
dataobjectObject containing user, url, and token.
data.userUserThe authenticated user, including the destination email address.
data.urlstringThe verification link to send to the user.
data.tokenstringThe token used by a custom verification URL.
requestRequest | undefinedRequest context supplied to the callback.

Returns

A Promise from the asynchronous email-sending callback; the documentation does not specify a distinct return value.

Key points

  • Email verification requires supplying a sender callback in the authentication configuration.
  • Better Auth invokes the callback as the verification flow begins.
  • The callback can address the message using the supplied user object and its email address.
  • Use the generated URL as the clickable destination in the outgoing message.
  • The token is available for applications that implement a custom verification URL.
  • A client-side call can manually resend or initiate the verification email.

Common mistakes

  • When email verification is required, signing in can invoke the callback again, so the email operation should tolerate repeated requests.
  • The URL is the value the recipient must open; sending only the token requires implementing a custom verification URL.

Example: Send a verification email

import { betterAuth } from "better-auth";

export const auth = betterAuth({
  emailVerification: {
    sendVerificationEmail: async ({ user, url, token }, request) => {
      await sendEmail({
        to: user.email,
        subject: "Verify your email address",
        text: `Click the link to verify your email: ${url}`,
      });
    },
  },
});

Configure the callback to deliver the verification URL through your email provider.

When to use it

Send a verification link after signup

New-account verification

Gate sign-in until the email address is verified

Required verification

Build a custom URL using the supplied token

Custom verification flow

Manually trigger another verification message

User-requested resend

Interview questions

QWhat is sendVerificationEmail in Better Auth?

It is the callback configured under emailVerification that sends the verification message. Better Auth calls it with user, url, token, and the request context.

Follow-up: How can an application request another message? Use the client’s sendVerificationEmail method with the user’s email and an optional callbackURL.

QWhich values does the callback receive and how are they used?

The callback receives the destination URL in url; the example sends that URL in the email text. The token is also available when a custom verification URL is needed.

Follow-up: What should a custom URL preserve? It must retain enough information, such as the verification token, for the verification flow to complete.

QWhen is the callback triggered?

If requireEmailVerification is enabled, users must verify their email before logging in. The callback can be triggered during sign-in and can also be invoked manually from the client.

Follow-up: How should the sender handle repeated calls? Make delivery idempotent or otherwise safe to retry, and avoid exposing tokens outside the intended verification link.

  • emailVerification
  • sendOnSignUp
  • sendOnSignIn
  • requireEmailVerification
  • autoSignInAfterVerification
  • authClient.sendVerificationEmail

Source: Email - Better Auth. Checked 2026-10-15.