Skip to main content
March 2025

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.

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
  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(opens in a new tab) has the full field list.