Skip to main content
View as Markdown

Email Templates

Authentication emails are the part of your product a user reads before they have ever seen your app. auth.emailTemplates replaces the defaults with your own subject and body.

Every template is optional — Better Auth supplies a sensible default for each, so an app that sets none still sends working mail.

app.yaml
auth:
  strategies:
    - type: emailAndPassword
    - type: magicLink
  emailTemplates:
    verification:
      subject: Verify your email for MyApp
      text: 'Hi $name, confirm your email: $url'
    resetPassword:
      subject: Reset your password
      text: 'Reset your password: $url'
      html: '<p>Click <a href="$url">here</a> to reset your password.</p>'
    magicLink:
      subject: Your sign-in link
      text: 'Sign in to MyApp: $url'

The Eight Templates

Template When it is sent
verification Email verification after sign-up.
resetPassword Password-reset request.
magicLink Magic-link sign-in.
emailOtp Email one-time code (its presence enables email-OTP).
twoFactorBackupCodes Two-factor backup codes delivery.
welcome Welcome email after verification.
accountDeletion Account-deletion confirmation.
invitation Admin-issued invitation (passwordless onboarding).

Template Shape

Each template takes a required subject and an optional text and/or html body.

Key Description
subject Required. Subject line. Supports $variable.
text Plain-text body. Supports $variable.
html HTML body. Supports $variable.

Supplying both text and html gives clients a choice; supplying only text is the safest default, since it renders everywhere and never trips a spam filter on markup.

Variables

Bodies and subjects support $variable substitution. Which variables carry a value depends on the email being sent — $code is meaningless in a password reset, $inviterName only in an admin invitation.

Variable Meaning
$url Action link (verify, reset, magic link, invitation accept).
$name Recipient's name.
$email Recipient's email address.
$code One-time code (email-OTP).
$organizationName Organization name (invitations).
$inviterName Name of the admin who sent the invitation (admin invitations only).
app.yaml
auth:
  emailTemplates:
    invitation:
      subject: '$inviterName invited you to MyApp'
      text: |
        Hi $name,
        $inviterName invited you to join.
        Set your password: $url

Last updated September 1, 2026

This documentation was written with AI, so errors or outdated content are possible. Sovrium is in beta. Contributions and corrections are welcome.

Built with Sovrium