1. Content Hub User

Email templates

Templates for email notifications are available in Sitecore Content Hub and can be used to ensure consistent communication and branding across your content. You can edit the content of these templates, combining plain text, variables, and dynamic fields as needed. After editing a template, you can send a test email to confirm the effects of your changes.

Email templates are defined as entities of the type M.Mailing.Template and have the following structure:

Property

Description

Variables

M.Mailing.TemplateName

A unique name for the email template.

Not supported

M.Mailing.TemplateDescription

The description of what the template is used for.

Not supported

M.Mailing.Variables

A list of variables that can be used in the body of the email template.

Not supported

M.Mailing.Subject

The subject of the email template.

Supported

M.Mailing.Body

The body of the email template.

Supported

Localization

For users to receive localized versions of emails, they must specify the display language in their user profile. If no language is defined, the email is sent using the first available culture in the Culture setting.

Dynamic content

Content Hub uses the Handlebars templating language to generate emails with dynamic fields. You can use Handlebar syntax in the subject or body of the email template to render dynamic content.

Specific Content Hub methods are available to use properties from entity definitions as described in the following table:

Method definition

Description

Use

bool ifCond_long(long value1, string operator, long value2)

Performs an equality check between value1 and value2. Supported operators are: ==, !=, < , <=, >, >=.

{{#ifCond_long var1 "==" var2}} <p>var1 is equals to var2</p> {{/ifCond_long}}

long operation_long(long value1, string operator, long value2)

Performs an operation on value 1 and value 2. Supported operators are: +, -, *, /.

{{operation_long var1 "+" var2}}

string m_page_url(string path)

Generates a link to a Content Hub page (for example, http://<HOSTNAME>/pages/en-US/search).

<a href="{{m_page_url 'search'}}">link</a>

string m_url(string path)

Generates a URL based on your Content Hub instance using a relative path (for example, http://<HOSTNAME>/api/entities/1).

{{m_url "api/entities/1"}}

string string_format(string format, string variables...)

Formats a string using the specified variables. Use square brackets instead of braces for variables.

Javascript uses braces for object notation (for example, How's your Monday going?).

{{string_format "How's your [0] going?" "Monday"}}

string attachment_url(string content-id)

Generates the URL of an attachment included in the email (for example, cid:my-content-id).

{{attachment_url "my-content-id"}}

If you have suggestions for improving this article, let us know!