Docs/Templates/Merge Tags

Merge Tags

Merge tags inject dynamic contact data into your email subject lines and body content. Use them to personalize greetings, reference custom fields, show conditional content, and insert required links — all with a simple double-brace syntax.

Overview

Merge tags use a double-brace syntax: {{tag_name}}. When EmailSendX sends a campaign, it replaces each tag with the corresponding value for the recipient contact.

Merge tags can be used in:

  • Email subject lines — e.g., Hey {{first_name}}, your April update is here
  • Email body (any editor mode — Visual, HTML, MJML)
  • Preview text
  • From name — e.g., Alex from {{workspace_name}}

Always include {{unsubscribe_link}}

Including {{unsubscribe_link}} in every campaign email is required by CAN-SPAM law. EmailSendX will auto-insert a standard unsubscribe footer if this tag is missing from your template — but it's best practice to include and style it yourself so it fits your design. Removing the auto-inserted footer requires explicit inclusion of the tag.

Standard Tags

These tags are available in every workspace and resolve from built-in contact and workspace properties:

TagDescriptionExample output
{{first_name}}Contact's first nameJohn
{{last_name}}Contact's last nameSmith
{{email}}Contact's email addressjohn@example.com
{{unsubscribe_link}}Required one-click unsubscribe URL (renders as full URL)https://t.emailsendx.com/u/...
{{view_in_browser}}URL to view the email as a web pagehttps://t.emailsendx.com/v/...
{{workspace_name}}Your workspace nameAcme Agency
{{current_year}}The current 4-digit year2026
{{current_month}}The current month nameApril
{{campaign_name}}Name of this campaign (internal name)April Newsletter
bash
# Example subject line using standard tags:
"Hi {{first_name}}, your {{current_month}} update from {{workspace_name}} is here!"

# Renders as:
"Hi John, your April update from Acme Agency is here!"

Custom Field Tags

Reference any workspace-level custom field using the custom. prefix followed by the field's slug:

bash
# Custom field examples (slugs are lowercase with underscores)

{{custom.company}}         → "Acme Corp"
{{custom.plan}}            → "pro"
{{custom.renewal_date}}    → "2026-12-01"
{{custom.monthly_spend}}   → "149"
{{custom.account_manager}} → "Sarah Lee"

# In a subject line:
"Your {{custom.plan}} plan renews on {{custom.renewal_date}}"
# → "Your pro plan renews on 2026-12-01"

Custom field slugs are set when you create the field in Workspace Settings → Custom Fields. The slug is shown next to the field name in the settings panel. If your field is named "Account Manager", its auto-generated slug would be account_manager.

Date custom fields are output as YYYY-MM-DD format. If you want a more readable format (e.g., "December 1, 2026"), use a text field instead and store the date in the format you want.

Conditional Blocks

Use Liquid-style conditional blocks to show or hide content based on contact data. This is especially useful for personalized greetings, tier-specific offers, or language variations.

bash
# Basic if/else
{% if first_name %}Hi {{first_name}},{% else %}Hi there,{% endif %}

# Checking a custom field value
{% if custom.plan == "pro" %}
  <p>As a Pro user, you get access to priority support.</p>
{% elsif custom.plan == "business" %}
  <p>Your Business plan includes a dedicated account manager.</p>
{% else %}
  <p>Upgrade to Pro or Business for priority support.</p>
{% endif %}

# Checking if a field is set at all
{% if custom.company %}
  <p>We're excited to work with the team at {{custom.company}}!</p>
{% endif %}

# Checking a tag
{% if contact.has_tag("vip") %}
  <p>Your exclusive VIP offer is inside.</p>
{% endif %}

Conditional blocks work in all editors

Conditional block syntax works in the Visual, HTML, and MJML editors. In the Visual editor, paste the conditional syntax directly into a text block. Use the preview feature with sample data to verify your conditions render correctly before sending.

Supported operators in conditions:

  • == — equals
  • != — not equals
  • >, <, >=, <= — numeric comparisons
  • contains — string contains check
  • Bare variable: {% if first_name %} is truthy when the field is non-empty

Fallback Values

When a merge tag references a field that's empty or missing for a given contact, EmailSendX outputs nothing by default — which can result in awkward copy like "Hi ," with no name. Use the | default: filter to specify a fallback:

bash
# Fallback for empty fields
{{first_name | default:"there"}}
# → "Hi there," when first_name is empty

{{custom.company | default:"your company"}}
# → "Excited to work with your company!" when company is missing

{{custom.plan | default:"free"}}
# → Shows "free" when no plan is set

# Nested: combine with conditional
Hi {{first_name | default:"there"}},

We're glad you joined {{custom.company | default:"us"}}!

Fallback vs conditional — which to use?

Use | default: for simple substitutions (a word or phrase). Use {% if %} blocks when the alternative content is a full sentence or paragraph that differs significantly from the main content.

Testing merge tags before sending

The template and campaign editors both include a Preview with data mode. Enter sample values for each field (or select an existing contact as a preview subject) to see exactly how the email will render for that person. Always preview with at least two contacts — one with complete data and one with missing fields — to verify your fallbacks are working.

Personalize every email

Merge tags let you greet contacts by name, reference their plan, show conditional offers, and more — at scale.