Skip to main content
All CollectionsTemplates
How to use merge fields
How to use merge fields

Unlock the power of merge fields for crafting personalized email messages.

Support Team avatar
Written by Support Team
Updated over 7 months ago

Merge fields are special tags used in email templates that will be replaced with appropriate content after sending an email, depending on the merge field. Some merge fields refer to your contact's information, while others like {unsubscribe} or {view} do not. Below we present the most important functions of merge fields that will be useful in everyday use.

How to use Merge Fields in practice

By adding a phrase in curly brackets, a correctly added Merge Field turns into a form of a pill, as presented below:

  • After opening the curly bracket in the template editor, our system shall display the list of example values that can be added)

Important note! Always use single brackets when you create a merge field. Please double-check your templates if you're importing them from another source and change any double brackets to single ones - { }.

Please also note that the below examples show two different ways of implementing merge fields:

Drag and Drop editor:

{example1} - plain merge tag in curly brackets. A merge tag in this form can be included directly into a template created with our drag and drop editor, e.g. into a "link" field of a button.

RawHTML Editor:

<a href="{example2}">Example text</a> - a merge tag in curly brackets embedded into a HTML hyperlink tag. This example is intended for templates composed in our rawHTML editor only.

Common Merge Fields

Creating an unsubscribe link URL {unsubscribe}

  • Merge field "unsubscribe" can be used simply - as a merge field itself, but can also be included in a link

  • After sending the message, this merge field turns into a link which - when clicked - takes the user to the 'Unsubscribe' page. If you want to learn more about the 'Unsubscribe' settings, click here.

  • After confirming the intention to unsubscribe, the contact changes its status to 'Unsubscribe'. To learn more about contact statuses, click here

Adding or removing the contact from lists that have “subscription management” option enabled - {unsubscribelist}

  • When 'Subscription management' is enabled for the contact list, contacts can choose which lists to subscribe to and which ones to unsubscribe from.

  • This merge field is useful if you want to be able to manage preferences for audience from specific lists without giving this option to all your recipients.

Enabling a contact to opt-out of the lists they're subscribed to - {unsubscribefromlist}

  • Enables a contact to remove themselves from the chosen lists.

  • When a recipient clicks on the unsubscribe link generated by {unsubscribefromlist}, he’s directed to a page where he can confirm his decision to unsubscribe from the particular email list associated with that merge field.

Updating the profile information - {contactprofile} and {contactprofile:publicformid}

  • Generates a URL which can be used in a link.

  • Contacts are directed to a form to update their contact information. With the {contactprofile} tag, only email, firstname and lastname fields are available.

  • You can create a custom form with your custom fields and use the {contactprofile:publicformid} replacing the publicformid with your actual publicformid for the given form you would like to use. To do this, please follow the provided steps:

1. Create a custom form.

2. Go to the Publish tab and find "publicformid" in the HTML code. Copy it.

3. In the email template, use the {contactprofile:publicformid} merge field.

4. Replace "publicformid" with the actual public form ID that you have just copied.

This will allow your recipient to easily update their contact information using the custom form you created.

Displaying the title of a webpage - {pullcontent-title:url}

  • This merge field allows to display the title of the webpage at the specified URL.

  • It can be used in an email's subject.

  • Example:

{pullcontent-title:https://elasticemail.com/}

  • The link needs to come from an existing site and has to include the http or https!

Transfer of the HTML content to the URL- {pullcontent:url}

  • Will render the HTML of the webpage at the specified URL.

  • Can be referenced and modified within scripting fields using Javascript. You can find more details on template scripting here: link

  • Content is cached on our server - cache time is 5 minutes. This means that we grab this data from our cached storage and retain it for 5 minutes. If any changes to this data were made within this 5 minutes period, you may need to wait in order to see them.

  • Example:

  • Important note! The link needs to come from an existing site and has to include the http or https!

RSS content - {pullcontent-rss:url}

  • Will download and render the contents of the RSS feed into your email.

  • URL is the URL of the feed. This URL should be extracted from the site's RSS and copied:

  • Optional: "count=X" - replace X with the number of items from the feed you would like to include.

  • Optional: "newcontentonly" - if this parameter is present then the tag will only pull down items from the rss feed that have been added since the last time this tag was used.

  • Example:

  • Example:

  • RSS content will be rendered with the following format:

<div class="media-item">

<img src="..." />

<div class="media-item-body">

<h5><a href=”link”>Media heading</a></h5>

Media Description - Example: Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.

</div>

</div>

Displaying the MessageID parameter - {msgid}

  • Displays the email's MessageID.

  • The MessageID is the email's unique identifier that is found in the message headers.

  • Example:

Displaying the email in browser - {view}

  • Opens and displays the email in the internet browser.

  • Generates a URL that can be used in a link.

  • Used for "View on the web".

  • Example:

<a href="{view}">View On Web</a>

Creating an URL for subscriber activation - {url}

  • Generates a URL for Subscriber activation.

  • This is the link which shall be used when you want to send an activation email that allows your Subscribers to activate via the Double Opt-In form (when enabled). When customer receives the activation email and clicks on the created link, its status changes on the contact list from “NotConfirmed” to “Active”. If more information about Double Opt-in forms is required, you’re invited to check the dedicated article, available here.

  • To create a custom form template for Double Opt-in subscriptions, {url} merge field shall be used. <a href="{url}">Activate</a>

Creating a link for customer to confirm their consent - {consent}

  • Generates a link used for Subscriber's consent confirmation.

  • Gives you a recent record of consent from any contact that clicks the link.

  • Example:

<a href="{consent}">Confirm</a>

  • It is possible to link the consent buttons to your own "thank you" page.

<a href="{consent:https://yourownpage.com/}">Confirm</a>

Allowing/Denying click and open tracking - {consenttrackingallow} and {consenttrackingdeny}

  • It generates a link that allows the subscriber to confirm whether they allow or deny tracking opens or clicks in received emails. .

  • Example:

<a href="{consenttrackingallow}">Allow tracking</a>

<a href="{consenttrackingdeny}">Deny tracking</a>

  • It is possible to link the consent buttons to your own "thank you" page.

<a href="{consenttrackingallow: https://yourownpage.com/}">Allow tracking</a>

Referrals - {referrals}

  • Sends a link to a referral with the Elastic Email logo

Contact Merge Fields

The following merge fields can be used when sending to your audience:

  • {recipient} **Note when this is used, it will default to contact's firstname if available, then lastname, then email address.

  • {email}

  • {firstname}

  • {lastname}

  • It's possible to create custom contact merge fields - eg. if you upload a contact list with a "phone" field, you will be able to call it via {phone}. More information about custom contact fields is available HERE

Merge Field Fallbacks

It is possible to create a "fallback" for merge fields when the value is not provided (eg. contact didn't provide his/her name):

{mergefieldname:fallbackvalue}

If the value in the merge field is empty (null) it will use the second value. Example:

Hello {firstname:friend}!

If "firstname" value exists on the contact, the merge field will use the content of the "firstname" (eg. "Hello Adam!"), otherwise it will use the second value provided after the ":" sign (eg. "Hello friend!").

Please note that custom values for merge fields have a limit of 100 characters in total.

Profile Merge Fields

These fields are used to display your profile information in the email's body. More information can be found here: link

  • {accountaddress}

  • {accountemail}

  • {accountfirstname}

  • {accountlastname}

  • {accountcompany}

  • {accountaddress1}

  • {accountaddress2}

  • {accountcity}

  • {accountstate}

  • {accountcountry}

  • {accountzip}

  • {accountphone}

  • {accountwebsite}

Transactional Templates

Elastic Email provides the option to use Templates created with our Email Designer or HTML Editor in your transactional emails. This feature allows you to pass personalized content to each of your recipients. You can find more details here: link

We hope you found the answer to your questions. If any issues require clarification, please contact us! We'll be happy to help.

Did this answer your question?