White labeling: Mail Templates
ThingsBoard uses mail templates to send email notifications when certain events occur — for example, account activation or password reset. The platform provides default templates that you can customize.
Mail templates are available only to the system administrator and tenant administrators.
Customize Mail Templates
Section titled “Customize Mail Templates”The system administrator edits the system mail templates directly, without the Use system mail templates checkbox. A tenant uses the system templates while Use system mail templates is selected, and clears it to use its own templates.
- Go to White labeling ⇾ Mail templates. The Mail templates settings card opens.
- If you are a tenant administrator, clear Use system mail templates.
- Select a template in the Mail template list.
- Edit the Mail subject and the Mail body.
- Click Save.
The following mail templates are available for customization:
| Template | Triggered when | Available placeholders |
|---|---|---|
| Test email message | An administrator sends a test email while configuring the outgoing mail server | ${targetEmail} |
| Account activation message | A new user is created and receives an activation link | ${activationLink}, ${activationLinkTtlInHours}, ${targetEmail} |
| Account activated message | A user successfully activates their account | ${loginLink}, ${targetEmail} |
| Account lockout message | A user’s account is locked due to too many failed login attempts | ${lockoutAccount}, ${maxFailedLoginAttempts}, ${targetEmail} |
| Reset password message | A user requests a password reset | ${passwordResetLink}, ${passwordResetLinkTtlInHours}, ${targetEmail} |
| Password was reset message | A user’s password has been successfully changed | ${loginLink}, ${targetEmail} |
| 2FA verification message | A 2FA code is sent to the user | ${code}, ${expirationTimeSeconds}, ${targetEmail} |
| Api usage state enabled | An API feature of the tenant, for example telemetry persistence, is enabled again | ${apiFeature}, ${apiLabel}, ${targetEmail} |
| Api usage state warning | The tenant’s usage of an API feature is close to its limit | ${apiFeature}, ${apiValueLabel}, ${targetEmail} |
| Api usage state disabled | An API feature of the tenant is disabled because its limit is reached | ${apiFeature}, ${apiLimitValueLabel}, ${targetEmail} |
The Api usage state emails are always sent with the system administrator’s templates, so a tenant’s changes to these three templates have no effect.
Placeholders
Section titled “Placeholders”The Mail body is processed as a template, so it supports placeholders written as ${placeholderName}. The platform substitutes them with actual values before sending the email. The Mail subject is sent as plain text — placeholders in the subject are not substituted.
Use only the placeholders listed for the given template above.
| Placeholder | Substituted with |
|---|---|
${targetEmail} |
Email address the message is sent to |
${activationLink} |
One-time link the user opens to activate their account |
${activationLinkTtlInHours} |
Lifetime of the activation link, in hours (rounded up) |
${loginLink} |
Link to the platform login page |
${lockoutAccount} |
Email address of the account that has been locked out |
${maxFailedLoginAttempts} |
Number of failed login attempts that triggers the lockout |
${passwordResetLink} |
One-time link the user opens to set a new password |
${passwordResetLinkTtlInHours} |
Lifetime of the password reset link, in hours (rounded up) |
${code} |
Two-factor authentication verification code |
${expirationTimeSeconds} |
Lifetime of the 2FA verification code, in seconds |
${apiFeature} |
Name of the API feature, for example Telemetry persistence or Email messages |
${apiLabel} |
Action the feature performs again, for example save or send |
${apiValueLabel} |
Current usage against the limit, for example saved 8M out of 10M allowed data points |
${apiLimitValueLabel} |
Usage that reached the limit, for example saved 10M data points |
Was this helpful?