User Actions Email Template

On this page

FusionAuth sends a User Action email when someone applies a User Action to a user, and asks FusionAuth to email the user. A time-based action can send an email in each phase: start, modify, cancel, and end. An action without a duration sends only the start email. Assign the templates in Start template, Modify template, Cancel template, and End template on the action under Settings -> User Actions .

FusionAuth sends the email only when the action has Email user when action is taken enabled, and the request sets action.emailUser to true. All four templates receive the same variables, so one template can serve every phase by checking phase.

Example Template#

FusionAuth ships no default for this template. Start from the following example:

[#switch "${phase}"]
  [#case "start"][#assign message = "The ${action.name} action was applied to your account."][#break]
  [#case "modify"][#assign message = "The ${action.name} action on your account changed."][#break]
  [#case "cancel"][#assign message = "The ${action.name} action on your account was canceled."][#break]
  [#default][#assign message = "The ${action.name} action on your account ended."]
[/#switch]
<p>
  ${message}
</p>
[#if (event.reason)??]
<p>
  Reason: ${event.reason}
</p>
[/#if]
- FusionAuth Admin
[#switch "${phase}"]
  [#case "start"][#assign message = "The ${action.name} action was applied to your account."][#break]
  [#case "modify"][#assign message = "The ${action.name} action on your account changed."][#break]
  [#case "cancel"][#assign message = "The ${action.name} action on your account was canceled."][#break]
  [#default][#assign message = "The ${action.name} action on your account ended."]
[/#switch]
${message}

[#if (event.reason)??]
Reason: ${event.reason}

[/#if]
- FusionAuth Admin

Replacement Variables#

action
  • Type: Object

The User Action object, such as action.name. For field definitions, see the User Actions API.

baseUrl
  • Type: String
  • Available since 1.68.0

The base URL for links in the email. FusionAuth uses the Application baseURL, then the Tenant baseURL, then http://localhost:9011.

event
  • Type: Object

The User Action event, with details such as event.reason and event.expiry. The variable is missing when a CleanSpeak moderation decision triggers the action.

phase
  • Type: String

The phase of the action: start, modify, cancel, or end.

tenant
  • Type: Tenant

The Tenant object. For field definitions, see the Tenant API.

user
  • Type: User

The User object for the user who received the action. For field definitions, see the User API.