Managing e-mail templates
Kentico sends automatic system e-mails for various purposes, for example workflow notifications. The content of such e-mails is determined by templates according to the type of the given e-mail. Many Kentico features send e-mails based on predefined templates that are included in the default installation.
To edit the templates, open the E-mail templates application. Editing templates allows you to alter the e‑mails sent by the system to match the required design and/or language.
There are two types of e-mail templates:
- Global - only users with the Global administrator privilege level can manage global e-mail templates. Choose the (global) option in the Site selector.
- Site-specific - allow you to override the global templates for specific websites. You need to select the appropriate Site and create a new template with a Code name that matches the corresponding global template.
The system only contains global templates by default.
When editing e-mail templates, the following properties are available:
Property |
Description |
Display name |
The name of the template displayed in the administration interface. |
Code name |
Serves as a unique identifier of the e-mail template (for example in the API). |
E-mail type |
Identifies the type of functionality to which the template is related. This can be used to categorize and filter e-mail templates. |
From |
E-mail address used as the sender (From) address of the e-mail. |
Cc |
E-mail addresses of copy recipients. |
Bcc |
E-mail addresses of blind copy recipients (receive a copy of the e-mail, but cannot see the addresses of other recipients in the mail). |
Subject |
Subject of the e-mail. |
HTML version |
Defines the content that is used for the template when sending e-mails in HTML format. Supports all standard HTML tags and syntax (tables etc.). You can select the preferred format using the Settings -> System -> E‑mails -> E‑mail format setting. |
Plain text version |
Plain text version of the e-mail template. |
Example of the HTML version of a template:
<html>
<head>
</head>
<body style="font-size: 12px; font-family: arial">
<p>
This is an automatic notification sent by Kentico. The following page is waiting for your approval. Please sign in to the Kentico administration interface and approve it.
</p>
<p>
<strong>Page:</strong> <a href="{%DocumentEditUrl%}">{%documentname%}</a> {% ifEmpty(DocumentPreviewUrl, "", "(<a href=\"" + DocumentPreviewUrl + "\">preview</a>)")|(encode)false %}
<br />
<strong>Last approved by:</strong> {%approvedby%}
<br />
<strong>Last approved when:</strong> {%approvedwhen%}
<br />
<strong>Original step:</strong> {%originalstepname%}
<br />
<strong>Current step:</strong> {%currentstepname%}
<br />
<strong>Comment:</strong>
<br />
{%comment%}
</p>
</body>
</html>
Most templates contain macro expressions (such as {% currentstepname %}), which the system resolves dynamically when sending the e-mails. The use of macros is necessary to ensure that individual e-mails contain information relevant to the situation that caused the e-mail to be sent. You can add macros into fields by clicking Insert macro () or write the required expressions manually.
If you wish to display data loaded via a macro in a specific format, you can apply transformations. See Using transformations in macro expressions for more information.
You can attach files to an e-mail template through the Attachments button in the header of the template editing page. The attachments are included when the system sends out e-mails based on the given template. Clicking the button opens a dialog where you can manage the attachments.