Skip to content

Email templates and variables — Postovio Help

The shape of a template

A template has an identifier (order.confirmation), a subject line, and a body. Both subject and body can contain variables.

The identifier is what your application sends. Changing it breaks your integration, so choose it deliberately; editing the content is safe at any time.

Variables

Variables use double braces and are replaced at send time:

Hi {{first_name}}, your order {{order_id}} is on its way.

Values come from the vars object in the API call:

{
  "template": "order.confirmation",
  "to": "ada@example.com",
  "vars": { "first_name": "Ada", "order_id": "A-10423" }
}

A missing variable does not render as blank. The send is rejected with an error naming the variable. This is intentional: an email reading “Hi , your order is on its way” is worse than no email, and silently blank fields are very hard to notice in production.

Use {{first_name|there}} to supply a fallback where a value is genuinely optional.

Loops

For line items and similar lists:

{{#each items}}
  {{this.quantity}} x {{this.name}} — {{this.price}}
{{/each}}

Testing

Send test delivers to your own address using sample values you provide, and does not count against your quota.

Test with awkward data, not tidy data: a name with an apostrophe, an order with one item and an order with forty, a currency that is not yours. Templates almost always break on the long list or the unusual character, never on the example in the documentation.

Versioning

Editing a live template creates a new version. The previous version stays available, and you can roll back from the template’s history. Sends in flight complete on the version they started with.