Email message templates

The message templates are used in the message generation process. A message job can use a message template to provide notification. The template is the content of the message that is sent. For example, a message template can be a template for password recovery or a custom newsletters. Each message template can contain placeholders that will be replaced with specific property values. The IMessageTemplateRequest class specifies the required information and the MessageTemplateRequestProxy class implements it and you can use it as a parameter where the interface is needed.

Creating a persistent message template and using it with a new message job

The sample below demonstrates how to create a persistent message template with new message job:

Creating a new message template and use it with a new message job

The sample below demonstrates how to create a new message template with new message job:

Merging message templates with additional information

Merge operations take place when the Notification service prepares the message for sending. In general, the template placeholders are replaced with specified merge tags. There are system tags, such as Subscriber.FirstName Subscriber.LastName, but you can use custom tags, that you pass through the contextItems parameter of the Send method. For every merge tag to be parsed, it must be surrounded by {| and |} asin the code sample below. The custom merge tags have a higher priority than the system merge tags. If you specify a custom merge tag (pass it in the contextItems dictionary) that is identical to a system merge tag, that is used in the template, the custom merge tag value will be used to replace the placeholder.

Merging tags while creating a message template

The sample below demonstrates how to send message using merge tags in the message template:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?