DocsTemplates

Templates

Store reusable email content once and send it by alias, filling in the per-recipient bits with a data model. Good for receipts, password resets, welcome emails, anything you send repeatedly.

Create a template

Open Templates → New, give it an alias (a short id you'll reference in code, e.g. welcome), and author the subject, HTML, and optional text versions. Use {{ placeholders }} for the parts that change per send.

Send with a template

Reference the alias and pass a templateModel with the values:

POST https://api.mailhuset.com/v1/email
Authorization: Bearer $MAILHUSET_API_KEY

{
  "from": "Acme <hello@yourdomain.com>",
  "to": ["sam@example.com"],
  "templateAlias": "welcome",
  "templateModel": { "name": "Sam", "plan": "Pro" }
}

Mailhuset renders the template's subject/html/text with your model. Any subject/html/text you also pass override the rendered output, handy for one-off tweaks.

Tips

  • Keep an alias stable once code depends on it; change the content freely.
  • Always include a text version alongside HTML. It improves

deliverability and covers plain-text clients.

  • Test by sending yourself a message with a sample model before going live.

Related


Need help? Email support@mailhuset.com.