Macros#

Macros are dynamic placeholders that Sendmachine replaces when an email is sent. They allow you to personalize emails, insert recipient data, generate links, and display conditional content - all from a single template.

Macros make it possible to send one email that looks different for every recipient.

What are macros?#

A macro is a placeholder written in the following format:

[[MACRO_NAME]]

When an email is delivered, Sendmachine replaces the macro with a real value.

Example:

<p>Hello [[FIRSTNAME]],</p>
<p>This email was sent to [[EMAIL_TO]]</p>
<a href="[[UNSUB_LINK]]">Unsubscribe</a>

Where macros can be used#

Macros work everywhere in an email:

Location

Example

Email body

<p>Hello [[FIRSTNAME]]</p>

Email subject

Welcome [[FIRSTNAME]]

Links

<a href="[[UNSUB_LINK]]">Unsubscribe</a>

SMTP headers

X-SM-Campaign: My newsletter

Transactional emails

SMTP or HTTP API