You can add, edit or test an email template using the tempate toolbar , or navigate to the /comms/templates URL to access all the email templates.
The template editor opens when you add or edit a template. You edit the following information required for a complete template.
- The name of the template. It must be unique amongst all the templates for the same application;
- The application which the template belongs. The application cannot be changed for saved templates;
- The type of template:
- Default: this type of template is editable using the HTML editor. Support simple data binding using {xxx} syntax;
- Razor: select this type to create template that uses programming logic to generate output. The composed the template must conform to the Microsft Razor page syntax. The reference of the razor syntax can be found here: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/razor?view=aspnetcore-3.0
Discovering the data for binding in template
Application provides a set of data for display when invokes the template rendering API. However, the data set varies for different operation. You can use the following steps to discover what is available for binding for the particular operation:
- Create a Default type template;
- Add {*} to the body;
- Navigate to the template configuration page, e.g. OneList notification channels, RoleManager email settings, and select the template for the operation;
- Click the Test Mail button on the template toolbar;
- The the full data set is displayed as JSON.