Using mailing variables with Twig

With Twig, you can use properties of the current mailing in your email content. For example, you can automatically display the subject line, sender or send date.

Where can you use these variables?

You can use these variables in HTML that supports Twig, such as the HTML of a template, layout or content block in the drag-and-drop editor.

Place a variable between double curly brackets:

{{ mailing.subject }}

The final value is inserted when the mailing is processed. Always check the result in a preview or test mailing.

General mailing properties

VariableDescription
mailing.idThe internal ID of the mailing.
mailing.nameThe internal name of the mailing.
mailing.subjectThe subject line of the mailing.
mailing.langThe language code of the mailing.
mailing.campaign_idThe internal ID of the campaign to which the mailing is linked.
mailing.campaign_nameThe name of the campaign to which the mailing is linked.
mailing.sendout_idThe ID of the sendout. This value is not available in every context.
mailing.has_triggersIndicates whether the mailing uses triggers. The value is true or false.

Sender and reply address

VariableDescription
mailing.sender_nameThe sender name.
mailing.sender_emailThe sender email address.
mailing.reply_nameThe name configured for replies. This value can be empty.
mailing.reply_emailThe reply address of the mailing. This value can be empty.

The following, more readable variables are also available for sender and reply details:

{{ sender.name }}
{{ sender.email }}
{{ reply.name }}
{{ reply.email }}

Prefer these variants when you only need sender or reply details.

Date and time

Mailing send date

Use mailing.sendDate to display the send date:

{{ mailing.sendDate|date("d-m-Y") }}

Example output:

28-08-2026

Other formats include:

{{ mailing.sendDate|date("d-m-Y H:i") }}
{{ mailing.sendDate|date("Y-m-d") }}

The send date depends on the context in which the mailing is processed. Always check the value in a preview, test mailing or actual sendout.

Current date and time

Use "now" to display the date and time at which the content is processed:

{{ "now"|date("d-m-Y") }}

In a sent email, the inserted value remains unchanged. In the online web version, "now" is recalculated whenever the page is opened. The displayed date can therefore change over time.

This is useful, for example, for automatically displaying the current year in a trademark or copyright notice:

© {{ "now"|date("Y") }} Company name

Use mailing.sendDate when the original send date must remain visible, for example to show the edition or publication date of a newsletter:

Newsletter dated {{ mailing.sendDate|date("d-m-Y") }}

Processing context

The following variables describe the context in which MailPro processes the mailing. They are mainly intended for advanced templates and conditional logic.

VariableDescription
mailing.inBrowsertrue when the mailing is displayed as an online version.
mailing.testModetrue when the mailing is processed in a test context.
mailing.previewtrue when the mailing is processed as a preview.
mailing.contactSenderIndicates whether the contact sender is used in the current processing context.
mailing.tracking_pixelIndicates whether the tracking pixel is used for the current mailing.

Example:

{% if mailing.inBrowser %}
  This text is displayed in the online version.
{% endif %}

Handling empty values

Not every property has a value in every context. This applies, for example, to mailing.sendout_id, mailing.reply_name and mailing.reply_email.

Check the value before displaying it:

{% if mailing.reply_email %}
  Reply address: {{ mailing.reply_email }}
{% endif %}

Important

  • Variables are case-sensitive. Use mailing.sendDate, for example, and not mailing.senddate.
  • Some values are internal IDs and are mainly useful in technical templates or troubleshooting.
  • Availability and output can differ between a preview, test mailing, sendout and online version.
  • Always create a preview and send a test mailing before publishing a template.