Managing email templates

Kentico sends automatic system emails for various purposes, for example workflow notifications. The content of such emails is determined by templates according to the type of the given email. Many Kentico features send emails based on predefined templates that are included in the default installation.

To edit the templates, open the Email templates application. Editing templates allows you to alter the emails sent by the system to match the required design and/or language.

There are two types of email templates:

  • Global - only users with the Global administrator privilege level can manage global email 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 email 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 email template (for example in the API).

Email type

Identifies the type of functionality to which the template is related. This can be used to categorize and filter email templates.

From

Email address used as the sender (From) address of the email.

Cc

Email addresses of copy recipients.

Bcc

Email addresses of blind copy recipients (receive a copy of the email, but cannot see the addresses of other recipients in the mail).

Subject

Subject of the email.

HTML version

Defines the content that is used for the template when sending emails in HTML format. Supports all standard HTML tags and syntax (tables etc.).

You can select the preferred format using the Settings -> System -> Emails -> Email format setting.

Plain text version

Plain text version of the email 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 emails. The use of macros is necessary to ensure that individual emails contain information relevant to the situation that caused the email 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 email template through the Attachments button in the header of the template editing page. The attachments are included when the system sends out emails based on the given template. Clicking the button opens a dialog where you can manage the attachments.