Hacking Sitecore and Life one pipeline at a time!

Creating A Custom Email Template: Part 1

Creating a Custom Email Template

Today we begin our second mini-series in 25 Days of Sitecore EXMCreating a Custom Email Template which is intended for more of a technical Sitecore audience. Part of the excitement of Sitecore Email Experience Manager is creating email templates that provide a similar look and feel as the associated website content.  Even more important, is that the experience content authors have is nearly identical. To provide that experience, we start by having developers or Sitecore power users create Messages using Sitecore’s Branch Template mechanism.

Audience Assumptions

This blog series makes the following assumptions about the audience reading it. In order to get the most out of this blog post, having technical experience in Sitecore is required. This blog post is going to cover concepts specific to EXM, but is not going to explain fundamental Sitecore operations fully. Additionally, this blog series is going to assume that HTML/CSS for emails are already created and associated Layouts, Sublayouts, and Renderings are already created.

Branch Templates

Sitecore’s Message Templates are driven by Sitecore’s Branch Template strategy.  To review this, we are going to exam the Sample Newsletter that is shipped with EXM.  Opening up Template Manager, we’re going to traverse the tree down to the following: /sitecore/templates/Branches/System/Email/Sample Newsletter/Sample Newsletter

This is just a Sitecore Branch Template. The name and icon that are specified will be the icon and name used in the Message Template types are displayed to the user. Additionally, the child items of this branch template are the items that are created when a message is created.

Branch Template Review

As a reminder, Branch templates are special Sitecore templates that, when items are created off of a branch template, the item (and resulting child items) created are a copy of the branch structure.

Message Parts

If you recall from Part 3 of Sending Your First Email, I broke down the anatomy of an email message and introduced two item types: Message Item and the Message Root. These concepts create the foundation that we’ll be explaining during the rest of this email message.

Message Item

The message item is the Branch Item template that we’ll create which sets up the structure of an email message. When we create a new EXM Message off of the Sample Newsletter template, the name we give the email message in EXM is used in place of the $name item name below, which is basic Sitecore branch functionality. 

When we create our new branch template for a custom email message, we’ll want to base it off of one of the predefined message type templates that come packaged out of the box with Sitecore EXM. 

For the most part, we are always going to be using the AB Testable Message type, as that provides the full EXM functionality (including A/B variant testing) features that we described in the previous mini-series.

AB Testable Message

This is the standard message template type that provides all of the functionality described thus far in email messages and dispatch. This template inherits from the base template of Mail Message

This message type exposes one field that maps to a Body. The Body field is used to map a Message Root item.

When EXM creates a message based on this template, the link in the Message Body is updated to map to the newly created item. This is why we create branch templates for AB Testable Messages.


This is the message template type chosen when you upload/import an HTML file to Sitecore EXM. This template inherits from AB Testable Message.

Mail Message

This is a foundation template that is used as a base template in most of the other types.  Consider this an abstract template as you probably wouldn’t create a new message template based on this template.

Plain Text Message

This simple email type exposes two files: a Subject and a Body. These fields are just single and multi-line text fields respectively. This message inherits from Mail Message. When this email is dispatched, it will simply send a text email message with no formatting. When using this template type, there are no AB Variant controls exposed in EXM.

Base HTML Message

This is a foundation template that inherits from Mail Message. This sets up EXM to send a non-testable HTML Message. Ordinarily, no messages would be created directly from this template.

Simple HTML Message

This is a simple HTML Message template that is basically a big Rich Text Editor for the author. This template inherits from Base HTML Message and has no AB variant testing nor does it have component based layouts with data sources. 

Message Root

The message root item is needed when we use AB Testable Message as part of the Message Body link.  This item is special because EXM uses it to display the EXM Experience Editor. The Message Root item contains the Presentation layouts for displaying a component-based, testable message. This also allows for component personalization. 

Any child items under Message root are simple data sources used by the controls above to get their data.  In the Sample Newsletter example, the Message Root item in the Branch template was altered to have Insert Options to create different parts of the Sample Newsletter.

These insert options were used to create the branch template that we see in the example.  We’ll explore the data sources contained in the Sample Newsletter in more detail in Part 2 of this mini-series.

Creating a new Branch Template

For this example, we are going to be creating a message template type called Branded Marketing Announcement. This message is going to be a AB Testable message with components and data sources.

1. Create a Branch Folder

We’ll start by creating a Branch Folder in User Defined.

2. Create a new Branch

In this new folder, create a new Branch Item. For this example, we want to choose the AB Testable Message template that is in the  System/Email templates.

After choosing the AB Testable Message this will create our default Branch item, like below.

3. Change the Item Name

Change the Item name to Branded Marketing Announcement. This will be the name that is displayed in EXM when an author is choosing what Message to send.

4. Change The Icon

For aesthetics, and for helping the content author out, changing the icon can be helpful.  For this example, we’ll choose the big old @ sign. (It took me 15 minutes to pick an icon. The perils of a Sitecore developer!)

5. Review the Message Item

The Branch item creates the first item in the branch, which is our selected AB Testable Message item.  There are two parts here that we can change: the icon and the message body field. 

6. Create a Message Root

Because this is an AB Testable Message which contains a Body field, we need to create a Message Root item that is a child of the Message Item that we created. There are no insert options for this, so we’ll be creating a new item from a selected template.

Make note of the item name. Here we’re calling it Message Root. The item name here isn’t as important, but for consistency I call it the same as the Sample Newsletter.

7. Adjust the Message Item Body Field

Now that our Message Root item is created, we need to go back to our Message Item and select that item in the Body field.

8. Change the Icon of the Message Item

This is purely a personal opinion. I don’t like seeing the branch icon showing up in the content tree on content that has a unique name (such as using the $name variable). So I like to change the icon here.  I like using the Envelope icon here.

This completes Part 1 of Creating a Custom Email Template and brings Day 9 to a close!  Tomorrow we’ll pick up by exploring how to add personalization and data sources to our branch template.

Don’t forget to register for my Sitecore EXM webinar on December 13 EXM Live! An Email Automation Experience!

Register for EXM Live! Webinar

To register for this webinar, visit https://dx.connectivedx.com/2018-exm-webinar

Tagged as: ,

Categorised in: EXM, Sitecore

1 Response »


  1. 25 Days of Sitecore EXM | Sitecore Hacker

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 1,238 other subscribers

Blog Stats

  • 132,847 hits
Follow Sitecore Hacker on WordPress.com
Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S in the U.S. and other countries.  This website is independent of Sitecore Corporation, and is not affiliated with or sponsored by Sitecore Corporation.
%d bloggers like this: