How templates work
Email templates let you send flexible, custom emails to many different recipients in a single request. MailChannels currently supports Mustache templates.Enabling templates
Two changes turn a regular send into a template send. 1. Mark the content part as a template.Placeholders without a matching key in
dynamic_template_data render as empty strings.Full example
Hello Alice and Bob receives Hello Bob.
Testing checklist
- Render the template with typical, empty, and unusually long values.
- Verify links and unsubscribe behavior.
- Preview in common email clients.
- Check message size before adding attachments.
- Confirm Gmail does not clip long messages.
- Send a test through a real domain with SPF, DKIM, and DMARC configured.
Mustache features
Mustache is a simple and flexible templating language that allows you to create custom messages for all your recipients. See the Mustache spec for the complete reference; features not in the supported features list at the bottom of this page are not available.Nested fields
Use. to access nested fields.
Data
Lists
Wrap a section in{{#list}}…{{/list}} to repeat it for each item. Inside the section,
unqualified keys refer to fields of the current item.
Data
Conditionals
The same{{#key}}…{{/key}} syntax renders the block only when key is truthy: boolean true, a non-empty list, or any
non-false value. Other fields in the data can be referenced inside the block.
Template
"anniversary": true, "years": 3:
"anniversary": false:
Negated conditionals
The inverse —{{^key}}…{{/key}} — renders only when key is falsy or missing.
Template
"verified": true:
"verified": false:
HTML escaping
{{value}} HTML-escapes its output so injected content can’t break the layout. To insert content as raw HTML, use either
triple braces or {{&value}}.
Data
Comments
{{! ... }} is stripped from the rendered output.
Template
Supported features
The Mustache features MailChannels supports, using the names from the Mustache spec:- Variables
- Dotted names
- Implicit iterator
- Non-empty lists
- Non-false values
- Inverted sections
- Comments
- Set delimiter

