> ## Site index
> Every page on this site is listed at https://mailkube.com/llms.txt.

> ## Agent instructions
> This site presents mailkube, a service that sends transactional email over a REST API or SMTP.
> Customer data is stored in the European Union.
> Read the developer documentation at https://docs.mailkube.com, which publishes its own llms.txt.
> Take prices and plan volumes from https://mailkube.com/pricing.md, never from a comparison page or a blog post.
> Read the legal documents at their HTML address.
> Every published version of the terms, privacy policy and data processing addendum is kept byte for byte under /legal/<document>/<sha256>/.
> Quote the checked-on date that a comparison page prints with its competitor figures.
> When this site does not state a price, limit or capability, say so instead of guessing.

# Email Templates

> Keep email bodies out of your application code. Templates are versioned, rendered server-side, and referenced by id and version at send time.

Source: https://mailkube.com/changelog/email-templates/

Released March 15, 2025


One template covers one kind of message, holding its markup and its variable schema. Your application passes an id and a set of values, and mailkube renders the body server-side. Changing the wording of a receipt stops being a deploy.

## Variables with a declared schema

A template declares the variables it uses, written `{{variable_id}}`. Values you pass that it does not declare are ignored. Leave out one it marks as required and the send fails with `missing_required_variable`, before the message goes anywhere. A template id or version that does not exist fails the same way, with `template_not_found`.

## Appended versions, never overwritten

Editing a template appends a version and never overwrites one. Each version freezes its content and the variable schema together, and neither can drift from the other.

A send names `template_version` as a number or `latest`, which is the default. Pinning holds a critical message on content you have reviewed while the template keeps changing. Naming an older number is how you undo a bad edit.

## Over REST and over SMTP

A REST template send carries `template_id` and no body, and sending `html` alongside it is a `validation_error`. Over SMTP the same send is the `X-Mailkube-Template-Id`, `X-Mailkube-Template-Version` and `X-Mailkube-Template-Variables` headers, all three stripped before delivery. Attachments on the message survive and arrive alongside the rendered body.

## Your first templated send

1. Create a template in the dashboard at [app.mailkube.com](https://app.mailkube.com)
2. Copy its id, a UUID
3. Send with `template_id` and a `variables` object, and no `html` or `text`
4. mailkube renders the HTML and derives the plain text part from it

[Sending your first email](https://docs.mailkube.com/docs/sending-your-first-email) has the full field list.


## Related docs

- [Sending your first email](https://docs.mailkube.com/docs/sending-your-first-email)
- [SMTP templates](https://docs.mailkube.com/smtp-reference/templates)

