Template Types
- transactional
- workflow
- campaign
Variable Basics
MailerPath provides built-in variables for every template send, organized by category: Company and BrandcompanyName can also be referenced as company_name or companyname. Use canonical names in your templates for clarity.
Using Variables in Transactional Emails
When you send a transactional email, MailerPath automatically populates built-in variables from:- Contact record (first name, email, company, etc.)
- Client settings (brand, sender, timezone, currency, etc.)
- System defaults (unsubscribe link, view in browser link, etc.)
Custom Variables
Custom variables let you send dynamic, application-specific data in addition to the built-in variables. Use them for:- Order details (order ID, total, items)
- Account-specific info (plan name, renewal date, discount code)
- Dynamic content (personalized recommendations, next steps, status messages)
How Variables Merge
Custom variables are merged with built-in variables. If your custom variable has the same name as a built-in variable, the custom value takes precedence. Nested objects (maps) merge recursively: Example: Built-in + Custom merge Built-in vars:Custom Variable Naming Rules
Custom variables follow the same alias rules as built-in variables. Use snake_case, camelCase, or lowercase in your templates—they all work:Use Cases
1. Transactional order confirmationBest Practices for Custom Variables
- Use consistent naming: Stick to snake_case across all sends to avoid confusion.
- Keep structure simple: 3–4 levels of nesting is ideal; avoid deeply nested structures.
- Provide defaults in templates: Use Handlebars conditionals for optional custom vars.
- Validate before sending: Ensure email addresses are valid, URLs are formatted, numbers are in expected ranges.
- Document your vars: List what custom variables your application will send so template designers know what’s available.
Data Type Support
Custom variables support:- Strings:
"order_id": "ORD-12345" - Numbers:
"total": 99.99 - Booleans:
"is_first_purchase": true - Arrays:
"items": [...] - Objects:
"shipping": {"address": "...", "cost": 5.00}
Preview Text Guidance
- preview_text is optional in your template.
- You can clear preview text by sending
nullor an empty string. - Preview text renders with the same variables as the subject and body, so you can use template variables here too.
Best Practices
- Keep a base template per brand or product line: Standardize layouts for consistency.
- Test with incomplete data: Test rendering when optional contact fields are missing.
- Keep subject lines variable-safe: Ensure subject lines stay readable if a variable is empty.
- Include required links: Always include unsubscribe and view-in-browser links for compliance and user experience.
- Use conditionals for optional custom vars: Wrap optional custom variables in Handlebars conditionals to handle cases where the data is missing.

