Skip to content
Agentmart
Submit a tool

using-email-templates

Use when creating or sending Mailtrap-hosted email templates, Handlebars personalization, template UUID in API payloads, or debugging variables and preview.

Skill by mailtrap

IndexedMIT★ 11
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/mailtrap-using-email-templates

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when creating or sending Mailtrap-hosted email templates, Handlebars personalization, template UUID in API payloads, or debugging variables and preview. Use when separating email design from application code for transactional or bulk sends.

Use cases: design, backend, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/using-email-templates

What's inside

Skill name
using-email-templates
Description
Use when creating or sending Mailtrap-hosted email templates, Handlebars personalization, template UUID in API payloads, or debugging variables and preview. Use when separating email design from application code for transactional or bulk sends.
License
MIT
Instructions
95 lines in SKILL.md · view on GitHub

Before installing

  • Instructions call the network

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Using Mailtrap email templates

## Overview

Templates are edited in the Mailtrap **UI**, referenced by **UUID** from your app, and filled with **Handlebars** data at send time. The same template can be used with **transactional** and **bulk (promotional)** streams; pick the stream when you integrate.

**Before generating SDK code:** read the README of the relevant SDK repository linked below for current method signatures. Do not rely on memory.

**Before generating API request bodies:** use the official docs and examples below—request shapes belong in the API reference, not in guesses (including when using AI-assisted coding).

**Template management via API** (create/update/list outside the UI): [Templates API](https://docs.mailtrap.io/developers/templates/templates.md).

**Related skills:** `authorizing-api-requests` (tokens, env vars, auth headers), `sending-emails` (bases and streams), `testing-with-sandbox` (preview sends without live delivery).

## When to use

- When sending or testing emails with Mailtrap-hosted templates (UUID in the send payload)
- Creating or editing templates in the **UI**
- Templates CRUD via [Templates API](https://docs.mailtrap.io/developers/templates/templates.md) (automations, provisioning)
- API body using `template_uuid` and `template_variables`
- Handlebars conditionals, loops, escaped vs unescaped HTML

## Quick reference

### API operations

In the developer docs, open:

- [Transactional – Send email (including template)](https://docs.mailtrap.io/developers/email-sending/transactional.md) (`https://send.api.mailtrap.io`)
- [Bulk – Send email (including template)](https://docs.mailtrap.io/developers/email-sending/bulk.md) (`https://bulk.api.mailtrap.io`)

Request body variant is typically **`EmailFromTemplate`** in the interactive reference.

### Authorization

Send with `Authorization: Bearer $MAILTRAP_API_TOKEN` on the matching stream host (`send.api.mailtrap.io` or `bulk.api.mailtrap.io`). Token scope, storage, and the alternative `Api-Token` header are covered in skill `authorizing-api-requests`.

### Example (`curl`) — template send

```bash
curl -X POST https://send.api.mailtrap.io/api/send \
  -H "Authorization: Bearer $MAILTRAP_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {"email": "hello@yourdomain.com", "name": "Your App"},
    "to": [{"email": "user@example.com"}],
    "template_uuid": "your-uuid",
    "template_variables": {"user_name": "Jane"}
  }'
```

### Payload shape

Replace literal `text`/`html` with template fields, for example:

- `template_uuid` (from the template **Integration** tab)
- `template_variables` (object whose keys match Handlebars variables)

Exact required fields (e.g. `from`, `to`) follow the same rules as non-template sends for that stream.

### Handlebars (supported patterns)

- `{{name}}` — escaped output; `{{{html}}}` — raw HTML
- `{{#if}}` / `{{#unless}}`, `{{#each}}`, `{{#with}}`
- Nested paths such as `{{order.id}}`
- Falsy values that suppress blocks include empty string, `0`, `false`, empty collections (see product docs)

Full syntax and examples: [Using Handlebars with Email Templates](https://docs.mailtrap.io/email-api-smtp/email-templates/handlebars.md). Testing workflow: [Testing templates with Handlebars](https://docs.mailtrap.io/email-api-smtp/email-templates/handlebars.md#testing-templates-with-handlebars). Sandbox preview sends: [Send test emails (sandbox)](https://docs.mailtrap.io/developers/email-sandbox/send-test-emails.md).

### Where templates live

**Templates** in the app sidebar. UUID and stream-specific integration snippets are under each template's **Integration** tab.

### Generating template HTML

Proactively offer to generate the template HTML when the user is creating a new template — don't wait to be asked. The output must be a real **email template** — not arbitrary web HTML — and must be **mobile-compatible** (responsive, renders well across email clients and screen sizes).

### SDKs

- [Node.js](https://github.com/mailtrap/mailtrap-nodejs)
- [Python](https://github.com/mailtrap/mailtrap-python)
- [PHP](https://github.com/mailtrap/mailtrap-php)
- [Ruby](https://github.com/mailtrap/mailtrap-ruby)
- [Java](https://github.com/mailtrap/mailtrap-java)
- [.NET](https://github.com/mailtrap/mailtrap-dotnet)
- [CLI](https://github.com/mailtrap/mailtrap-cli)

## Common mistakes

| Mistake                                   | Fix                                                                                                                                                                   |
| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Mixing `text`/`html` with `template_uuid` | Use template fields per API schema for template sends                                                                                                                 |
| Skipping sandbox for risky changes        | Preview with sandbox sending / Testing API (see `testing-with-sandbox` and [send test emails](https://docs.mailtrap.io/developers/email-sandbox/send-test-emails.md)) |

From mailtrap/mailtrap-skills, MIT.

Signals

Stars
11
Forks
1
Open issues
0
Last commit (this folder)
May 13, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from mailtrap

Cite this page

using-email-templates skill. Agent Mart. https://agentmart.dev/skills/mailtrap-using-email-templates (last updated 2026-10-24)