docs/content/reference/guides/notification-templates.md
Authelia uses templates to generate the HTML and plaintext emails sent via the notification service. Each template has
two extensions; .html for HTML templates, and .txt for plaintext templates.
This guide effectively documents the usage of the template_path notification configuration option.
| Template | Description |
|---|---|
| Event | Used to render notifications sent about events |
| IdentityVerificationOTC | Used to render notifications sent when stateful validation is required such as managing credentials |
| IdentityVerificationJWT | Used to render notifications sent when stateless validation is required such as resetting passwords |
For example, to modify the IdentityVerificationJWT HTML template, if your
template_path was configured as
/config/email_templates, you would create the /config/email_templates/IdentityVerificationJWT.html file to override the
HTML IdentityVerificationJWT template.
In template files, you can use the following placeholders which are automatically injected into the templates:
| Placeholder | Templates | Description |
|---|---|---|
{{ .LinkURL }} | IdentityVerificationJWT, IdentityVerificationOTC | The URL associated with the notification if applicable. |
{{ .LinkText }} | IdentityVerificationJWT, IdentityVerificationOTC | The display value for the URL associated with the notification if applicable. |
{{ .RevocationLinkURL }} | IdentityVerificationJWT, IdentityVerificationOTC | The Revocation URL associated with the notification if applicable. |
{{ .RevocationLinkText }} | IdentityVerificationJWT, IdentityVerificationOTC | The display value for the Revocation URL associated with the notification if applicable. |
{{ .BodyPrefix }} | Event | Prefix for the body event. |
{{ .BodyEvent }} | Event | The event description. |
{{ .Title }} | All | A predefined title for the email. |
It will be "Reset your password" or "Password changed successfully", depending on the current step. | ||
{{ .DisplayName }} | All | The name of the user, i.e. John Doe |
{{ .RemoteIP }} | All | The remote IP address (client) that initiated the request or event. |
{{ .Domain }} | All | The relevant domain for Authelia. |
This is a basic example:
<body>
<h1>{{ .Title }}</h1>
Hi {{ .DisplayName }}
This email has been sent to you in order to validate your identity.
Click <a href="{{ .LinkURL }}">here</a> to change your password.
</body>
Some Additional examples for specific purposes can be found in the examples directory on GitHub.
The original template content can be found on GitHub.
Several functions are implemented with the email templates. See the Templating Reference Guide for more information.