/mailtrap:converting-email-templatesfrom mailtrap
Converts email templates from SendGrid, Mailgun, Mandrill, Postmark, Brevo, and Amazon SES to Mailtrap-compatible Handlebars syntax. Supports single file, bulk directory, and inline HTML conversion.
Ships in mailtrap. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Automatically convert email templates from other email service providers into Mailtrap-compatible Handlebars syntax. Handles both deterministic pattern conversions (via a Python script) and complex edge cases (via LLM intelligence).
Related skills: using-email-templates (Handlebars syntax, API template send), sending-emails (stream bases and auth), authorizing-api-requests (tokens, env vars, account_id resolution — needed when creating templates or sending via the Templates API after conversion).
sendgrid, mailgun, mandrill-handlebars, mandrill-mergetags, postmark, brevo, or ses.html template files, or raw HTML pasted inline/converted/ subdirectory next to the inputIf the user does not specify the source provider, ask before proceeding. If the user provides template HTML inline (pasted in chat), save it to a temporary .html file first.
Fast mode (default): For providers with deterministic conversion patterns. The Python script handles these reliably.
Deep mode: Triggered when:
brevo AND the template contains nested loops, multiple filters, or complex conditional nestingExecute the Python converter script:
python3 {skill_dir}/scripts/converter.py \
--provider {provider} \
--input {input_path} \
--output {output_dir}
Where {skill_dir} is the directory containing this SKILL.md file.
Read the output:
Read the .report.txt file(s) generated alongside each converted template. For bulk conversions, also read _summary.txt.
Note: When flags are present, the script automatically:
<!-- WARNING: ... --> comment at the top of the converted file<!-- FLAGGED [RULE]: message --> HTML comments so the file can be pasted into the Mailtrap editor without triggering parser errorsFor each flag in the report:
references/conversion-rules.md for the specific rule and recommended action.formatDate, comparison helpers): Cannot be resolved in the template. Report to the user with a clear explanation of what they need to change in their application code. Suggest the replacement variable name.mc:edit regions): Apply the conversion using LLM judgment. Show the user the before/after and ask for confirmation before writing.Present flags grouped by category:
## Conversion Complete
### Auto-converted: [count] changes
[Brief summary or collapsed details]
### Needs your application code: [count] flags
[For each: what to change, why, suggested variable name]
### Needs verification: [count] flags
[For each: show before/after, ask for confirmation]
Single file:
Converted: {filename}
Changes: [count] | Flags: [count]
Output: {output_path}
[Show the conversion report summary]
[If flags exist, show the categorized flag breakdown from Step 3]
Bulk conversion:
Converted: [count] files
Total changes: [count] | Total flags: [count]
Clean: [count] files | Needs review: [count] files
Output: {output_dir}
[Show the summary report]
[List files needing review with their specific flags]
After template conversion, always remind the user about the API-side changes they need to make. Reference the quick mapping table:
| Provider | Old template field | Old variables field | Mailtrap field | Mailtrap variables |
|---|---|---|---|---|
| SendGrid | template_id | personalizations[].dynamic_template_data | template_uuid | template_variables |
| Mailgun | template | t:variables | template_uuid | template_variables |
| Mandrill | template_name | global_merge_vars + merge_vars | template_uuid | template_variables |
| Postmark | TemplateId/TemplateAlias | TemplateModel | template_uuid | template_variables |
| Brevo | templateId | params | template_uuid | template_variables |
| Amazon SES | TemplateName/TemplateArn | TemplateData | template_uuid | template_variables |
Only show the row for the provider that was just converted.
If the user pastes template HTML directly in chat instead of providing a file path:
references/conversion-rules.md directly using LLM intelligence.<!-- FLAGGED [RULE]: message --> HTML comments (same format as the script). This prevents editor errors when the user pastes the output into Mailtrap.<!-- WARNING: ... --> comment at the top of the converted output noting how many flagged patterns need resolution.This mode always uses Deep mode (LLM) since there is no file to pass to the script.
content/how-to-migrate-email-templates.md (opens in a new tab)references/conversion-rules.md (opens in a new tab)scripts/converter.py (opens in a new tab)tests/expected/brevo-test.html (opens in a new tab)tests/expected/mandrill-mergetags-test.html (opens in a new tab)tests/expected/postmark-test.html (opens in a new tab)tests/expected/sendgrid-test.html (opens in a new tab)tests/input/brevo-test.html (opens in a new tab)tests/input/mandrill-mergetags-test.html (opens in a new tab)tests/input/postmark-test.html (opens in a new tab)tests/input/sendgrid-test.html (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub mailtrap/mailtrap-skills --plugin mailtrap8 skills in this plugin
/authorizing-api-requestsUse when authenticating or authorizing requests to any Mailtrap API (Email Send, Email Testing/Sandbox, Templates, Contacts, Sending Domains, Suppressions). Use when picking the auth header, choosing token scope, storing tokens safely, or resolving the Mailtrap account_id. Use before writing or generating any Mailtrap API call./managing-contactsUse when using Mailtrap Contacts API or UI to add, update, bulk import, list, segment marketing contacts, custom fields, or custom events. Use when syncing contacts from a CRM or warehouse, or building audiences for campaigns./receiving-emailsUse when an application or AI agent needs to receive email with Mailtrap Inbound Email: creating inbound inboxes, reading incoming messages and attachments, handling the inbound webhook, replying to or forwarding received mail, threads, or automatic forwarding rules. Use when building email-to-ticket, email parsing, document intake, or giving an AI agent its own email address.Other plugins' skills for the same job