{

How to use merge fields

Merge fields can be used to personalise a mailing by including address data in the mail, for example a name. This page describes how you can use merge fields, shortened links and system links in your mailings.

Use custom merge fields

You can have up to 10 custom mergefields. In this example we'll show you how to use a "Name" and "City" merge field.

  1. Create a new address list with Name as MergeFieldHeading1 and City as MergeFieldHeading2.
    { "Name": "Demo", "MergeFieldHeading1": "Name", "MergeFieldHeading2": "City", }

  2. Add addresses to the address list with the name of recipient in MergeFieldValue1 and the city in MergeFieldValue2. If you define something as MergeFieldHeading8 on the address list, the data for that field should go in MergeFieldValue8 on the address.
    { "EmailAddress": "john.doe@cm.com", "MergeFieldValue1": "John Doe", "MergeFieldValue2": "Breda" }

  3. Use the merge field tag in the htmlbody or textbody of the template, or in the subject of the mailing. Examples of the tags in this case.
    Merge field name Tag used
    Name {{ Recipient.Name }}
    City {{ Recipient.City }}


  4. Add the mergefield as a mergetag object to the mergetags collection of the mergefields object of the template. The mergefield object consists of a Name, Value and a mapping. The Name should be the name of the mergefield, the Value should be the tag used in your template or subject, and the mapping should be the mapping to the field in the address.
    { "Name": "Recipient.Name", "Value": "{{ Recipient.Name }}", "Mapping": "Recipient.MergeFieldValue1" }, { "Name": "Recipient.City", "Value": "{{ Recipient.City }}", "Mapping": "Recipient.MergeFieldValue2" }

Default merge tags

The following default mergetags can be used in your mail.

Description Placeholder in body Merge tag object
Sender email address {{ Sender.EmailAddress }} { "Name": "Sender.EmailAddress", "Value": "{{ Sender.EmailAddress }}", "Mapping": "Sender.EmailAddress" }
Recipient email address {{ Recipient.EmailAddress }} { "Name": "Recipient.EmailAddress", "Value": "{{ Recipient.EmailAddress }}", "Mapping": "Recipient.EmailAddress" }

Use shortened links

You need to create links as special link in the mergefields object in order to be able to see the number of clicks of your link later on. Links provided as special link will automatically be shortened. In this example we will use https://www.cm.com as the url that we want to trak in our mailing.

  1. Create a tag to use in the htmlbody or textbody of the template, or in the subject of the mailing. For example: [[ SpecialLink.link1 ]]
  2. Add the link to the speciallinks collection of the mergefields object of the template. The special link consists of a Type, Label, Link and Mapping. The Type should be link, the Label you want to give this link, the Link should be the tag used in your template or subject and the Mapping should be the real url.
    { "Type": "link", "Label": "CM", "Link": "[[ SpecialLink.link1 ]]", "Mapping": "https://www.cm.com" }

System links

We have some default system links that you can use in your mailings.

Description Placeholder in body Special link object
Unsubscribe link, this will allow users to unsubscribe for your mailings.
They won't get mails when you try to send to them again.
[[ SpecialLink.Unsubscribe ]] { "Type": "system", "Label": "Unsubscribe", "Link": "[[ SpecialLink.Unsubscribe ]]", "Mapping": "SpecialLink.Unsubscribe" }
View in browser, this will allow users to view your mailing in the browser. [[ SpecialLink.ViewInBrowser ]] { "Type": "system", "Label": "View in browser", "Link": "[[ SpecialLink.ViewInBrowser ]]", "Mapping": "SpecialLink.ViewInBrowser" }
Pixel, this will allow you to track if a user has opened your mail.
This one should only be included in the html body and not in the text body.
[[ SpecialLink.Pixel ]] { "Type": "system", "Label": "Viewed", "Link": "[[ SpecialLink.Pixel ]]", "Mapping": "SpecialLink.Pixel" }

Complete example merge tags and special links

Address list:

{ "Name": "Demo", "MergeFieldHeading1": "Name", "MergeFieldHeading2": "City", }

Address:

{ "EmailAddress": "john.doe@cm.com", "MergeFieldValue1": "John Doe", "MergeFieldValue2": "Breda" }

Mailing template textbody:

Hello {{ Recipient.Name }}
According to our data your email address is {{ Recipient.EmailAddress }} and you live in {{ Recipient.City }}.
You can see our new and improved website on [[ SpecialLink.link1 ]]
Kind regards, Team CM
If you don't want to receive our mails anymore you can unsubscribe here: [[ SpecialLink.Unsubscribe ]] If your mail isn't looking correctly, you can view it in the browser here: [[ SpecialLink.ViewInBrowser ]]

Mailing template mergefields:

{ "MergeTags": [ { "Name": "Recipient.Name", "Value": "{{ Recipient.Name }}", "Mapping": "Recipient.MergeFieldValue1" }, { "Name": "Recipient.City", "Value": "{{ Recipient.City }}", "Mapping": "Recipient.MergeFieldValue2" }, { "Name": "Recipient.EmailAddress", "Value": "{{ Recipient.EmailAddress }}", "Mapping": "Recipient.EmailAddress" } ], "SpecialLinks": [ { "Type": "system", "Label": "Unsubscribe", "Link": "[[ SpecialLink.Unsubscribe ]]", "Mapping": "SpecialLink.Unsubscribe" }, { "Type": "system", "Label": "View in browser", "Link": "[[ SpecialLink.ViewInBrowser ]]", "Mapping": "SpecialLink.ViewInBrowser" }, { "Type": "link", "Label": "CM", "Link": "[[ SpecialLink.link1 ]]", "Mapping": "https://www.cm.com" } ] }