Template variables
{{var}} syntax, unsubscribeUrl, and declared variables.
Use placeholders in HTML and subject lines. At send time, MailingCore replaces them with values from your payload or system-generated URLs.
Syntax
Double curly braces, case-sensitive:
<p>Hello {{firstName}},</p>
<p>Your order {{orderId}} ships on {{shipDate}}.</p>
Declare variables on the version (variables array) for editor hints and validation:
{
"name": "firstName",
"type": "string",
"fallback": "there"
}
Supported types: string, number, boolean, url, email, image, color.
System variable: {{unsubscribeUrl}}
For newsletter and campaign emails, include a one-click unsubscribe link:
<a href="{{unsubscribeUrl}}">Unsubscribe</a>
MailingCore generates a signed URL per recipient (/u/:token). The hosted page supports ?lang= for localized copy (unsubscribeLang on send or campaign settings).
Passing values at send time
For transactional sends with templateVersionId, pass variables in the send metadata or dedicated fields supported by your integration. For campaigns, map contact fields (e.g. firstName from contact attributes) in the campaign configuration.
Common patterns:
| Pattern | Example |
|---|---|
| Greeting | {{firstName}} with fallback "there" |
| Deep link | {{ctaUrl}} type url |
| Unsubscribe footer | {{unsubscribeUrl}} in every marketing template |
| Brand color | {{brandColor}} type color |
Best practices
- Declare all custom variables on the version with sensible
fallbackvalues. - Always include
{{unsubscribeUrl}}in marketing templates (legal requirement in many jurisdictions). - Avoid JavaScript or logic in templates — use your app to compute values before send.
- Keep variable names alphanumeric (
firstName,order_id).
Related
- Publish workflow
- Send email —
templateVersionId,unsubscribeLang