Kentico CMS 7.0 Developer's Guide

E-mail templates

E-mail templates

Previous topic Next topic Mail us feedback on this topic!  

E-mail templates

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Kentico CMS sends automatic system e-mails for various purposes, such as workflow notifications. The content of these e-mails is determined by templates according to the type of a given e-mail. Many modules and features of Kentico CMS send e-mails based on predefined templates that are included in the default installation.

 

There are two types of e-mail templates: global and site-specific. If a site-specific template of a certain type is not defined, the respective global template is used by the site instead. All e‑mail templates can be modified in Site Manager -> Administration -> E‑mail templates and the templates of a given site may also be accessed in CMS Desk -> Administration -> E‑mail templates. Editing templates allows you to alter the e‑mails sent by the system to match the required design and/or language.

 

An e-mail template has the following properties:

 

Display name

The name of the template displayed in the user interface.

Code name

The name of the template used in code.

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 that will be 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. These will get a copy of the e-mail, but won't 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. The preferred format can be selected using the Site Manager -> 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 CMS. The following document is waiting for your approval. Please sign in to Kentico CMS Desk and approve it.

   </p>

   <p>

     <strong>Document:</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>

 

Please note that e-mail template properties may contain macro expressions, such as those marked in the code above, that are resolved (merged) when the e‑mail is sent. The use of macros is necessary to ensure that individual e-mails contain information relevant to the situation that caused them to be sent. In some cases, you may wish to display the data loaded via a macro in a specific format. This can be done by applying transformations as described in the Transformations in macro expressions topic.

 

It is possible to attach files to an e-mail template through the Attachments Attachments button in the header of the template editing page. When e-mails based on the given template are sent out, the attachments will be included. Clicking the button opens a dialog where the attachments can be managed.