Reference - Email marketing macro expressions

This page lists macro expressions available solely within the Email marketing application. To facilitate access, individual macro expressions are exposed via the following objects:

To add these expressions, click Insert macro () on the editor toolbar and select the appropriate option under the Context specific objects section.

Notes

  • All expressions described below are context macros, which means they must be enclosed in {% %} parentheses when entered into text or other general fields.
  • For personalization of email widgets, we recommend using only the macros described below. Using other types of macros may significantly reduce the performance of the system. 

Recipient

The Recipient entity exposes the following properties of individual recipients:

PropertyReturn typeDescription
FirstNamestringResolves into the First name property of the recipient, as specified in the associated contact information.
LastNamestringResolves into the Last name property of the recipient, as specified in the associated contact information.
EmailstringResolves into the Email property of the recipient, as specified in the associated contact information.
PersonaIDintResolves into the PersonaID property of the recipient, which identifies the persona assigned to the recipient.

Note

When processing macros for marketing emails, the system uses two separate resolving phases:

  • General macro expressions are resolved only once and the result is used for all email recipients
  • Macro expressions containing the Recipient entity are resolved separately for each email recipient

If you need to use variables from general macros within macros containing the Recipient entity, add the |(resolver)subscriber parameter to the end of the expression that defines the variables. For example:

{% defaultText = "Hello there!" |(resolver)subscriber %}
{% Recipient.FirstName == String.Empty ? defaultText : "Hello, " + Recipient.FirstName + "!"; %}

The (resolver)subscriber parameter added to the first macro ensures that the expression is resolved in the second phase along with the second Recipient macro.

Important: Only use the (resolver)subscriber macro parameter for scenarios where variable sharing is necessary. The system resolves such expressions separately for each recipient, which may reduce performance when sending a large number of emails.

If no recipients are available when previewing emails containing the Recipient macro, a fake contact with name Anthony Stark is used.

Email

The Email entity exposes properties of individual emails.

Note: The Email entity and all its macros are only available when editing email templates of the Email type and within the content of marketing email issues based on these templates.

PropertyReturn typeDescriptionNotes
NamestringResolves into the Name property of the given email.
SubjectstringResolves into the Subject property of the given email.
PreheaderstringResolves into the Preheader property of the given email.The usage of this macro in open conditions or loops is not supported.
SenderNamestringResolves into the Sender name property of the given email.
SenderEmailstringResolves into the Sender email address property of the given email.
ViewInBrowserUrlstringResolves into a URL that allows recipients to view the email in a browser.

EmailFeed

The EmailFeed entity exposes the following properties of individual email feeds:

PropertyReturn typeDescriptionNotes
NamestringResolves into the Name property of the email feed under which the macro resolves.
SubscriptionConfirmationUrlstringResolves into a link to the subscription approval page, as defined by the Approval page URL property of the given newsletter.Only available for Double opt-in templates.
UnsubscribeFromEmailFeedUrlstringResolves into a link to the unsubscription page, as defined by the Unsubscription page URL property of the given email feed.
UnsubscribeFromAllEmailFeedsUrlstringResolves into a link to the unsubscription page, as defined by the Unsubscription page URL property of the given email feed.

Furthermore, the following macro method can be used with the EmailFeed entity.

MethodReturn typeParametersDescription
GetAbsoluteUrlstring
  • EmailFeed emailFeed
  • string relativePath

Converts a relative path passed by the relativePath parameter into an absolute URL (using the Base URL configured for the email feed represented by the EmailFeed entity).

Example: {% EmailFeed.GetAbsoluteUrl("/graphics/image.png") %}