---
title: Preparing email templates
related:
  - https://docs.kentico.com/k10/on-line-marketing-features/managing-your-on-line-marketing-features/email-marketing/writing-marketing-emails.md
  - https://docs.kentico.com/k10/on-line-marketing-features/configuring-and-customizing-your-on-line-marketing-features/configuring-email-marketing/enabling-double-opt-in-for-newsletters.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

The content of the marketing emails sent by email campaigns and newsletters is based on templates (with the exception of page-based newsletter emails).

You can manage the templates on the **Template management** tab of the **Email marketing** application.

![Managing email campaign templates](https://docs.kentico.com/docsassets/k10/preparing-email-templates/newsletter_templates.png "Managing email campaign templates")

There are four types of templates:

- **Email** – define the layout and design of [static marketing emails](https://docs.kentico.com/k10/on-line-marketing-features/managing-your-on-line-marketing-features/email-marketing/writing-marketing-emails.md). Templates of this type typically contain editable regions where authors can enter the content of individual issues.
- **Double opt-in** – template for the email messages where contacts can confirm their subscription to newsletters that have [double opt-in](https://docs.kentico.com/k10/on-line-marketing-features/configuring-and-customizing-your-on-line-marketing-features/configuring-email-marketing/enabling-double-opt-in-for-newsletters.md) enabled.
- **Subscription**– templates for the confirmation email message sent when contacts subscribe to newsletters.
- **Unsubscription** – templates for the email message sent when recipients unsubscribe from email campaigns or newsletters.

## Creating email templates

To add new templates for a marketing email:

1. Open the **Email marketing** application on the **Template management** tab.
2. Click **New template**.
3. Type a **Display name** for the template.
4. Select the **Template type**.
5. Click **Save**.

   - The system creates the template and opens its **General** tab.
6. (Optional) Set the following properties:

   | Property  | Description                                                                                                                                                                                                                                                          |
   | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | Thumbnail | Allows you to upload an image that will be displayed as a representation of the template when creating new marketing emails.<br>Only available for _Email_ templates.                                                                                                |
   | Subject   | Sets the subject of the emails based on this template.<br>Only available for _Double opt-in_, _Subscription_ and _Unsubscription_ templates. This field is not available for _Email_ template, since authors enter the email subject when writing individual issues. |
7. Write the opening and closing HTML code of the email message in the **Header (HTML)** and **Footer (HTML)** fields (including the __ element).

   - You can leave the default values unless you need to customize the HTML envelope of the email messages based on the template.
8. Define the main layout and content of the template inside the **Body** editor.
   - You can type basic text or add advanced content using the editor toolbar.![Inserting an editable region into a template](https://docs.kentico.com/docsassets/k10/preparing-email-templates/inserting_editable_regions.png "Inserting an editable region into a template")

> **Tip:** **Adding regions to issue templates**
>
> _Email_ templates need to contain editable regions, where the authors of individual emails can enter content.
>
> To insert a region:
>
> 1. Type a region name into the  **Insert editable region** box below the main editor.
> 2. (Optional) Set the **Width** and **Height** of the region.
> 3. Click **Insert**.The body editor adds the region to the current cursor position as an expression in format:
>
> ```text
>
> $$regionName:width:height$$
> ```

> **Info:** **Adding marketing email macros**
>
> You can insert the following macros anywhere inside the body of the template:
>
> - **{% ActivationLink %}** – only available for _Double opt-in_ templates. Resolves into a link to the subscription approval page, as defined by the _Approval page URL_ property of the given newsletter.
> - **{% ActivationUrl %}** – only available for _Double opt-in_ templates. Resolves into the URL of the subscription approval page, as defined by the _Approval page URL_ property of the given newsletter.
> - **{% Email %}** – resolves into the email address of the email recipient.
> - **{% FirstName %}** – resolves into the first name of the recipient.
> - **{% LastName %}** – resolves into the last name of the recipient.
> - **{% UnsubscribeFromCampaign %}** – resolves into a link to the unsubscription page, as defined by the Unsubscription page URL property of the given email campaign or newsletter.
> - **{% UnsubscribeFromAllCampaigns %}** – resolves into a link to the unsubscription page, as defined by the Unsubscription page URL property of the given email campaign or newsletter.To add these expressions into the body, click **Insert macro** () on the editor toolbar and select the appropriate option under the **Context specific objects** section.
>
> **Note**: The macro expressions only work in emails sent to actual recipients. They do not resolve correctly in draft emails.
>
> You can also enter any other types of [macro expressions](https://docs.kentico.com/k10/macro-expressions.md) into email templates.

9. (Optional) Use the **CSS stylesheet** field to define any CSS classes that you want to apply to the emails based on this template.
10. (Optional) Add attachments to the email. We recommend attaching any assets, such as images or PDF files via Media libraries:
    1. Add the files that you want to add to a [media library](https://docs.kentico.com/k10/managing-website-content/working-with-files/media-library-files/inserting-files-into-media-libraries.md).
    2. In the email, click on where you want to link the attachment.
    3. In the text editor, click **Insert/Edit link** (for adding links) OR **Insert/Edit image or media** (for displaying assets directly in the email).
    4. On the Media library tab, select the file that you want to link.
    5. Adjust the properties, such as **Link text** if you're adding text.
    6. **Save & Close**.\
       The advantage of this approach is that the file in the email will always point to the most up-to-date file stored in the media library. Moreover, when sending the email, this approach does not affect performance the way attaching a file using the **Attachment** button does.
11. Click **Save**.

You can now use the template in your marketing emails.

## Assigning email templates to email feeds

In addition to the main template of the _Email_ type configured for static marketing emails, you can also add any number of alternative email templates to the selected email feeds.

To add an alternative email template to email feeds:

1. Open the**Email marketing**application on the **Template management** tab.
2. **Edit** () the selected template of the _Email_ type.
3. Switch to the **Email feeds**tab.
4. Click **Add email feeds**.
5. Select email feeds and click **Select**.

Once you have assigned an alternative email template to an email feed, authors can select the assigned template when [creating new marketing emails](https://docs.kentico.com/k10/on-line-marketing-features/managing-your-on-line-marketing-features/email-marketing/writing-marketing-emails.md) using **Show advanced options and UTM tracking settings**.
