skills/converting-email-templates/SKILL.md
Use when converting or migrating email templates from another provider (SendGrid, Mailgun, Mandrill, Postmark, Brevo, Amazon SES) to Mailtrap-compatible Handlebars syntax. Supports single file, bulk directory, and inline HTML conversion.
npx skillsauth add mailtrap/mailtrap-skills converting-email-templatesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
development
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.
development
Use when capturing outbound email in development or staging without delivering to real recipients, inspecting HTML or headers, running spam or structure checks, or automating tests against a fake inbox. Use when testing outgoing mail from an app without committing to a production ESP yet. Use when using Mailtrap Email Sandbox, Sandbox API, or sandbox-mode sending.
tools
Use when adding or verifying a Mailtrap sending domain, DNS propagation issues, registrar or DNS provider steps, compliance after verification, or click tracking. Domain must be verified before sending from it.
development
Use when integrating, configuring, or troubleshooting Mailtrap live email sending (Email API or SMTP). Use when wiring outbound mail from an application or choosing how to send.