Customize email templates
To customize an email template:- Go to Dashboard > Branding > Email Templates.
- From the Template dropdown, select the email template you want to update.
- On the email template page, update the fields you want to customize. The From address, Subject, Redirect To, and Message fields support Liquid. To learn more, read Supported Liquid Syntax.
- Click Save to save your changes, Try to test your changes, or Reset to revert your changes.
From Address
The From Address field sets the email address users see as the sender when receiving an email from Auth0. If unset, emails use the email address in the From field configured for your email provider. When setting the From Address field, to allow Auth0 to send digitally-signed emails on your behalf, you must configure two forms of email authentication:- Sender Policy Framework (SPF), which authorizes specific IP addresses to send email from a domain
- DomainKeys Identified Mail (DKIM), which cryptographically signs emails so mail servers can verify that it was sent from the reported domain
@ or empty, and the value to v=spf1 include:<YOUR_PROVIDER_SPF_DOMAIN> -all. The TXT record for DKIM should have the host name set to the domain you use to send emails and the value set to the DKIM signature you generate with your provider.
Subject
The Subject field sets the subject line of the email. If unset, Auth0 automatically populates the subject depending on the type of email.Message
The Message field sets the HTML content of the message body. Each template comes with a default message body which you can modify or discard entirely to write your own.URL Lifetime and Redirect to
Email templates that include a link (Verification Email (Link), Change Password (Link), and Blocked Account Email) have two additional fields to manage these links:- The URL lifetime field sets how long a link remains valid before it expires. By default, the lifetime is 432,000 seconds (five days).
- The Redirect To field sets a URL where a user is redirected after completing the action at an included link.
Universal Login currently ignores the value of the Redirect To field in the Password Reset template and instead redirects to the default login route or an error page.To customize the password reset Redirect To URL when using Universal Login, use
api.transaction.setResultURL() from the post-challenge Actions triggersuccessset totrueorfalseindicating whether the action was successfulmessageset to an additional description of the outcome, like “Access expired.” or “Your email was verified. You can continue using the application.”
Workaround for Redirect To URL query parameters in SPFs
Workaround for Redirect To URL query parameters in SPFs
RFC 3986 defines the expected order of a URL as
scheme|authority|path|query|fragment. However, SPA frameworks (like Angular) typically expect URLs in the scheme|authority|path|fragment|query format, which has the query after the fragment.This can cause an issue with the placement of query parameters in Redirect To URLs. If your SPA’s Redirect To URL is http://localhost:3000/#/register, the user is redirected to http://localhost:3000/?exampleParameter=exampleValue#/register instead of to http://localhost:3000/#/register?exampleParameter=exampleValue.To work around this limitation of SPA frameworks, you can:-
Add a server-side URL as the Redirect To URL with a
routeparameter that records the SPA route for the redirect. For example,http://localhost:3000/register?route=register. -
Create a server-side route controller that reads the
routeand other parameters from the URL, redirects to the SPA route specified inrouteparameter, and appends the other parameters received from Auth0. For example:
Test updated templates
To test, click Try, enter a valid email address that you have access to view, and choose the correct connection type. Auth0 sends the email for a default app that shares your tenant name (not your tenant’s friendly name). To test templates for different applications, create a sample user to go through the relevant flows. You can trigger verification emails manually for specific applications and users using the Management API Send an email address verification email endpoint.Example customization use cases
Customizing email templates enables many use cases. For example:Dynamic Redirect To URL
Dynamic Redirect To URL
You can set up different Redirect To URLs based on your application name. For example:Because the application name is encoded for security, use an encoded value (especially if your application name contains a character that changes once encoded). For example, use
My%20App instead of My App.Multilingual Subject and Message
Multilingual Subject and Message
Using Liquid, you can use the You can also use the
request_language parameter to pull the language setting from the header value or default to the user’s browser language setting.For example:user_metadata.lang property to alter the content based on the user’s preferred language. For example, you can use an Action to set the user_metadata.lang property, then read the user_metadata.lang parameter in your email templates to send emails in the appropriate language.