SKILL·84CEC4

using-email-templates

mailtrap
Updated Yesterday
7
1
7
View on GitHub
Metaaiapidesign

About

This skill enables developers to send emails using Mailtrap-hosted templates, separating email design from application code. It covers using template UUIDs in API payloads and personalizing content with Handlebars variables for transactional or bulk sends. Use it when you need to create, send, or debug these templated emails.

Quick Install

Claude Code

Recommended
Primary
npx skills add mailtrap/mailtrap-skills -a claude-code
Plugin CommandAlternative
/plugin add https://github.com/mailtrap/mailtrap-skills
Git CloneAlternative
git clone https://github.com/mailtrap/mailtrap-skills.git ~/.claude/skills/using-email-templates

Copy and paste this command in Claude Code to install this skill

Documentation

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.

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 (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:

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

curl -X POST https://send.api.mailtrap.io/api/send \
  -H "Authorization: Bearer $MAILTRAP_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {"email": "[email protected]", "name": "Your App"},
    "to": [{"email": "[email protected]"}],
    "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. Testing workflow: Testing templates with Handlebars. Sandbox preview sends: Send test emails (sandbox).

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

Common mistakes

MistakeFix
Mixing text/html with template_uuidUse template fields per API schema for template sends
Skipping sandbox for risky changesPreview with sandbox sending / Testing API (see testing-with-sandbox and send test emails)

GitHub Repository

mailtrap/mailtrap-skills
Path: skills/using-email-templates
0
FAQ

Frequently asked questions

What is the using-email-templates skill?

using-email-templates is a Claude Skill by mailtrap. Skills package instructions and resources that Claude loads on demand, so Claude can perform using-email-templates-related tasks without extra prompting.

How do I install using-email-templates?

Use the install commands on this page: add using-email-templates to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.

What category does using-email-templates belong to?

using-email-templates is in the Meta category, tagged ai, api, and design.

Is using-email-templates free to use?

Yes. using-email-templates is listed on AIMCP and free to install.

Related Skills

content-collections
Meta

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

View skill
polymarket
Meta

This skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.

View skill
creating-opencode-plugins
Meta

This skill helps developers create OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It provides the plugin structure, event API specifications, and implementation patterns for JavaScript/TypeScript modules. Use it when you need to intercept, monitor, or extend the OpenCode AI assistant's lifecycle with custom event-driven logic.

View skill
sglang
Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill