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.
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). |
emailOtp is not just cosmetic. Defining it enables the email-OTP sign-in flow — there is no strategy entry for OTP. Every other template only changes the wording of a flow you already turned on. See Magic Link & Email OTP.
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). |
auth:
emailTemplates:
invitation:
subject: '$inviterName invited you to MyApp'
text: |
Hi $name,
$inviterName invited you to join.
Set your password: $url
Templates do not deliver mail; SMTP does. Magic link, email-OTP, password reset, verification and invitation emails all require SMTP. With SMTP unset the app boots with email disabled and logs a warning — the templates are read, and nothing is sent. See Environment Variables.
Related Pages
- Strategies Overview — the
authblock these sit in. - Magic Link & Email OTP — the flow
emailOtpenables. - Email & Password — where
verificationandresetPasswordfire. - Invitations — where
invitationfires. - Two-Factor — where
twoFactorBackupCodesfires.
Last updated July 27, 2026
This documentation was written with AI, so errors or outdated content are possible. Sovrium is in beta — contributions and corrections are welcome.