Kentico CMS 7.0 Developer's Guide

Newsletter templates

Newsletter templates

Previous topic Next topic Mail us feedback on this topic!  

Newsletter templates

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

The e-mails sent by the Newsletter module are defined by templates (with the exception of dynamic newsletter issues). These templates can be managed in CMS Desk -> Tools -> Newsletters -> Templates.

 

devguide_clip0648

 

There are four types of templates:

 

Double opt-in - template for e-mail messages sent to users to confirm their subscription to a newsletter that has double opt-in enabled.

Newsletter issue - this is a template that defines the layout and design of static newsletter issues. Templates of this type typically contain editable regions where newsletter authors can enter the content of individual issues.

Subscription - template for the confirmation e-mail message sent when a user subscribes to the newsletter.

Unsubscription - template for the e-mail message sent when a user unsubscribes.

 

Editing templates

 

When editing a template, the following configuration can be made on the General tab:

 

Display name - sets the name of the template that is displayed in the newsletter interface.

Code name - sets the name of the template that is used as an identifier, for example in URLs or the API.

Thumbnail - allows you to upload an image that will be displayed as a representation of the template in the selection dialog (when creating new newsletter issues). Only available for Newsletter issue templates.

Subject - can be used to set the subject of the e-mails based on this template. This field is not available for Newsletter issue templates, since the e-mail subject is entered locally when writing individual issues.

Header (HTML) - the opening HTML code of the e-mail message, including the <html> element.

Body - defines the main layout of the e-mails that use this template. Here you can enter static text, use the WYSIWYG editor and insert macros or newsletter fields. Newsletter issue templates may also contain editable regions where editors can enter the content of individual newsletter issues. These can be inserted using the Insert editable region section below the editing area. Regions are inserted as expressions in format: $$regionName:width:height$$
 
devguide_clip1562
 

Footer (HTML) - the closing HTML code.

CSS stylesheet - may be used to define CSS classes that will be applied to the e-mails based on this template.

 

You can insert the following newsletter fields anywhere inside the body of the template:

 

{%ActivationLink%} - only available for Double opt-in templates. It is resolved into a link to the subscription approval page, as defined by the Approval page URL property of the given newsletter.

{%Email%} - resolves into the e-mail address of the e-mail recipient.

{%FirstName%} - resolves into the first name of the recipient.

{%LastName%} - resolves into the last name of the recipient.

{%UnsubscribeLink%} - resolves into a link to the unsubscription page, as defined by the Unsubscription page URL property of the given newsletter.

 

To easily add these expressions into the body, click the Insert macro (ckeInsertMacro) button on the WYSIWYG editor toolbar and select the appropriate option under the Context specific objects section.

 

Note: The newsletter field expressions only work in e-mails sent to actual subscribers. The macros do not resolve correctly when sending draft e-mails for newsletter issues, since the recipients are not linked to subscribers in the system.

 

Newsletter templates also support all other types of macro expressions.

 

You can attach files to newsletter templates and manage them as needed by clicking the Attachments Attachments button in the header of the editing page. When e-mails based on the given template are sent out, the attachments will be included. For example, if you wish to display a logo image somewhere in the template layout and have it stored directly in the e-mails, you can upload it as an attachment and then insert it into the body content. In the case of newsletter issue templates, further attachments may also be added when creating specific issues.

 

Assigning issue templates to newsletters

 

In addition to the main template configured for a static newsletter, it is also possible to add any number of alternative templates that may be selected for specific issues. When editing a Newsletter issue type template, you can assign it to individual newsletters on the Newsletters tab. Alternatively, newsletter-template bindings can be configured from the opposite side of the relationship by editing a static newsletter on its Templates tab.

 

Once a newsletter has multiple templates allowed, authors of issues can choose which one they wish to use in the first step of the New issue wizard.

 

devguide_clip1182

 

The template of an existing issue may also be changed through the Template selector available among the advanced options when editing the given issue on the Content tab.