--- title: 'Email templates' description: 'Customize the authentication and security notification emails Supabase Auth sends.' subtitle: 'Customize the authentication and security notification emails Supabase Auth sends.' --- Supabase Auth sends two kinds of email: authentication emails and security notifications. Authentication emails: - Confirm sign up - Invite user - Magic link or OTP - Change email address - Reset password - Reauthentication Security notification emails: - Password changed - Email address changed - Phone number changed - Sign-in method linked - Sign-in method removed - Verification method added - Verification method removed Supabase Auth sends a security notification only when that notification is turned on for the project. The confirmation email is sent only when email confirmations are on. In a hosted project, turn on **Confirm email** on the [Auth Providers page](/dashboard/project/_/auth/providers), or set `mailer_autoconfirm` to `false` with the [Management API](/docs/reference/api/v1-update-auth-service-config). In local development, set [`auth.email.enable_confirmations`](/docs/guides/local-development/cli/config#auth.email.enable_confirmations) to `true` in your config file, then restart the local stack. With confirmations off, users are confirmed on sign-up and no email is sent, so a customized confirmation template never reaches them. ## Template variables [#terminology] Templates can use the following variables: | Name | Description | | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `{{ .ConfirmationURL }}` | Contains the confirmation URL. For example, a sign-up confirmation URL looks like: `https://project-ref.supabase.co/auth/v1/verify?token={{ .TokenHash }}&type=email&redirect_to=https://example.com/path`. | | `{{ .Token }}` | Contains a 6-digit one-time password (OTP) to use instead of the `{{ .ConfirmationURL }}`. | | `{{ .TokenHash }}` | Contains a hashed version of the `{{ .Token }}`. Use it to build your own link in the email template. | | `{{ .SiteURL }}` | Contains your application's Site URL. Configure it in your project's [authentication settings](/dashboard/project/_/auth/url-configuration). | | `{{ .RedirectTo }}` | Contains the redirect URL passed when `signUp`, `signInWithOtp`, `signInWithOAuth`, `resetPasswordForEmail`, or `inviteUserByEmail` is called. Configure the redirect URL allow list in your project's [authentication settings](/dashboard/project/_/auth/url-configuration). | | `{{ .Data }}` | Contains metadata from `auth.users.user_metadata`. Use this to personalize the email message. | | `{{ .Email }}` | Contains the original email address of the user. Empty when you [link an email address to an anonymous user](/docs/guides/auth/auth-anonymous/convert#link-an-email--phone-identity). | | `{{ .NewEmail }}` | Contains the new email address of the user. This variable is only supported in the "Change email address" template. | | `{{ .OldEmail }}` | Contains the old email address of the user. This variable is only supported in the "Email address changed notification" template. | | `{{ .Phone }}` | Contains the new phone number of the user. This variable is only supported in the "Phone number changed notification" template. | | `{{ .OldPhone }}` | Contains the old phone number of the user. This variable is only supported in the "Phone number changed notification" template. | | `{{ .Provider }}` | Contains the provider of the linked or removed sign-in method. This variable is only supported in the "Sign-in method linked" and "Sign-in method removed" notification templates. | | `{{ .FactorType }}` | Contains the type of verification method that was added or removed. This variable is only supported in the "Verification method added" and "Verification method removed" notification templates. | ## Editing email templates Where you edit templates depends on how you run Supabase. ### Hosted projects Edit templates on the [Email Templates](/dashboard/project/_/auth/templates) page in the dashboard. The template builder uses the same [template variables](#terminology). You can also manage email templates using the Management API: ```bash # Get your access token from https://supabase.com/dashboard/account/tokens export SUPABASE_ACCESS_TOKEN="your-access-token" export PROJECT_REF="your-project-ref" # Get current email templates curl -X GET "https://api.supabase.com/v1/projects/$PROJECT_REF/config/auth" \ -H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN" \ | jq 'to_entries | map(select(.key | startswith("mailer_templates"))) | from_entries' # Update email templates curl -X PATCH "https://api.supabase.com/v1/projects/$PROJECT_REF/config/auth" \ -H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "mailer_subjects_confirmation": "Confirm your email address", "mailer_templates_confirmation_content": "
Follow the link below to confirm this email address and finish signing up.
", "mailer_subjects_magic_link": "Your sign-in link", "mailer_templates_magic_link_content": "Follow the link below to sign in. This link expires shortly and can only be used once.
", "mailer_subjects_recovery": "Reset your password", "mailer_templates_recovery_content": "We received a request to reset your password. Follow the link below to choose a new one.
If you didn't request this, you can safely ignore this email.
", "mailer_subjects_invite": "You've been invited", "mailer_templates_invite_content": "You've been invited to create an account. Follow the link below to accept.
", "mailer_subjects_reauthentication": "{{ .Token }} is your verification code", "mailer_templates_reauthentication_content": "Use the code below to verify your identity. It expires shortly.
{{ .Token }}
", "mailer_subjects_email_change": "Confirm your new email address", "mailer_templates_email_change_content": "Follow the link below to confirm {{ .NewEmail }} as your new email address.
If you didn't request this change, you can safely ignore this email.
", "mailer_notifications_password_changed_enabled": true, "mailer_subjects_password_changed_notification": "Your password was changed", "mailer_templates_password_changed_notification_content": "The password for your account was recently changed.
\nIf you didn't make this change, reset your password and contact support immediately.
", "mailer_notifications_email_changed_enabled": true, "mailer_subjects_email_changed_notification": "Your email address was changed", "mailer_templates_email_changed_notification_content": "The email address for your account was changed from {{ .OldEmail }} to {{ .Email }}.
\nIf you didn't make this change, contact support immediately.
", "mailer_notifications_phone_changed_enabled": true, "mailer_subjects_phone_changed_notification": "Your phone number was changed", "mailer_templates_phone_changed_notification_content": "The phone number for your account was changed from {{ .OldPhone }} to {{ .Phone }}.
\nIf you didn't make this change, contact support immediately.
", "mailer_notifications_mfa_factor_enrolled_enabled": true, "mailer_subjects_mfa_factor_enrolled_notification": "A new verification method was added to your account", "mailer_templates_mfa_factor_enrolled_notification_content": "Sign-in verification method {{ .FactorType }} was added to your account.
\nIf you didn't make this change, contact support immediately.
", "mailer_notifications_mfa_factor_unenrolled_enabled": true, "mailer_subjects_mfa_factor_unenrolled_notification": "A verification method was removed from your account", "mailer_templates_mfa_factor_unenrolled_notification_content": "Sign-in verification method {{ .FactorType }} was removed from your account.
\nIf you didn't make this change, contact support immediately.
", "mailer_notifications_identity_linked_enabled": true, "mailer_subjects_identity_linked_notification": "A sign-in method was linked to your account", "mailer_templates_identity_linked_notification_content": "Your {{ .Provider }} account was linked as a sign-in method for {{ .Email }}.
\nIf you didn't make this change, contact support immediately.
", "mailer_notifications_identity_unlinked_enabled": true, "mailer_subjects_identity_unlinked_notification": "A sign-in method was removed from your account", "mailer_templates_identity_unlinked_notification_content": "Your {{ .Provider }} account was removed as a sign-in method for {{ .Email }}.
\nIf you didn't make this change, contact support immediately.
" }' ``` ### Local development and self-hosted The dashboard template builder doesn't apply to [local development with the CLI](/docs/guides/local-development) or [self-hosted Supabase](/docs/guides/self-hosting). With the CLI, customize templates in your config file (`supabase/config.toml` or `supabase/config.jsonc`) and in local HTML files. Self-hosted Supabase uses environment variables instead. For local development with the CLI, [open the emails your templates produce in Mailpit](/docs/guides/auth/testing-auth-flows#test-email-flows-locally).Dear Developer,
Welcome to Billy, the scalable developer platform!
Best Regards,
Billy Team
Dear Developer,
Welcome Billy, the scalable developer platform!
As an early access member, you have access to select features like Point To Space Restoration.
Best Regards,
Billy Team