id | title | description | subtitle |
---|---|---|---|
customizing-email-templates |
Customizing email templates |
Customizing local email templates using config.toml. |
Customizing local email templates using config.toml. |
You can customize the email templates for local development using the config.toml
settings.
You should provide a relative URL to the content_path
parameter, pointing to an HTML file which contains the template. For example
<CH.Code>
[auth.email.template.invite]
subject = "You are invited to Acme Inc"
content_path = "./supabase/templates/invite.html"
<html>
<body>
<h2>Confirm your signup</h2>
<p><a href="{{ .ConfirmationURL }}">Confirm your email</a></p>
</body>
</html>
</CH.Code>
There are several Auth email templates which can be configured:
auth.email.template.invite
auth.email.template.confirmation
auth.email.template.recovery
auth.email.template.magic_link
auth.email.template.email_change
The templating system provides the following variables for use:
Contains the confirmation URL. For example, a signup confirmation URL would look like:
https://project-ref.supabase.co/auth/v1/verify?token={{ .TokenHash }}&type=signup&redirect_to=https://example.com/path
Usage
<p>Click here to confirm: {{ .ConfirmationURL }}</p>
Contains a 6-digit One-Time-Password (OTP) that can be used instead of the ConfirmationURL
.
Usage
<p>Here is your one time password: {{ .Token }}</p>
Contains a hashed version of the Token
. This is useful for constructing your own email link in the email template.
Usage
<p>Follow this link to confirm your user:</p>
<p>
<a href="{{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=email"
>Confirm your email</a
>
</p>
Contains your application's Site URL. This can be configured in your project's authentication settings.
Usage
<p>Visit <a href="{{ .SiteURL }}">here</a> to log in.</p>
Contains the user's email address.
Usage
<p>A recovery request was sent to {{ .Email }}.</p>
Contains the new user's email address. This is only available in the email_change
email template.
Usage
<p>You are requesting to update your email address to {{ .NewEmail }}.</p>
These settings are for local development. To apply the changes locally, stop and restart the Supabase containers:
supabase stop && supabase start
For hosted projects managed by Supabase, copy the templates into the Email Templates section of the Dashboard.