A hybrid tool that automatically converts email templates from other providers into Mailtrap-compatible Handlebars syntax. Supports single file and bulk directory conversion.
| Provider | Template Engine | Conversion Complexity |
|---|---|---|
| SendGrid | Handlebars | Low-Medium - convert insert helpers, flag formatDate/comparison helpers |
| Mailgun | Handlebars | Low - no syntax changes, API field renaming only |
| Mandrill (Handlebars) | Handlebars | Low - no syntax changes, flag mc:edit regions |
| Mandrill (Merge Tags) | Mailchimp *|VAR|* |
Medium - full merge tag to Handlebars conversion |
| Postmark | Mustachio (Mustache) | Low-Medium - convert conditionals {{#var}} to {{#if var}} |
| Brevo | Pongo2/Django | High - full template rewrite (different syntax entirely) |
| Amazon SES | Handlebars | Low - no syntax changes, API field renaming only |
python3 scripts/converter.py --provider sendgrid --input template.html --output ./converted/python3 scripts/converter.py --provider brevo --input ./my-templates/ --output ./converted/0- Clean conversion, no flags1- Conversion completed with flags (manual review needed)2- Error
The converter uses a hybrid approach:
- Python script (
scripts/converter.py) - Handles deterministic regex-based conversions. Fast, reliable for well-defined patterns. - Claude Code skill (
SKILL.md) - Orchestrates the script and handles complex edge cases (nested Brevo loops, ambiguous patterns) using LLM intelligence.
- SendGrid
{{insert name "default=X"}}to{{#if name}}{{name}}{{else}}X{{/if}} - Mandrill merge tags
*|VAR|*to{{var}} - Postmark conditionals
{{#var}}...{{/var}}to{{#if var}}...{{/if}} - Brevo
{% if %},{% for %},params.prefix,|default:filters - And more (see
references/conversion-rules.mdfor full details)
formatDatehelpers (need server-side formatting)- Comparison/logical helpers (
greaterThan,and,or) - Brevo date filters
- Mandrill
mc:editeditable regions - Nested loops with ambiguous variable scoping
For each converted file, the script generates:
- The converted
.htmlfile - A
.report.txtwith line-by-line changes and flags
For bulk conversions, a _summary.txt is also generated with totals.
.
├── SKILL.md # Claude Code skill definition
├── scripts/
│ └── converter.py # Python regex converter
├── references/
│ └── conversion-rules.md # Complete rule reference
├── content/
│ └── how-to-migrate-email-templates.md # KB article
└── tests/
├── input/ # Test templates (one per provider)
├── expected/ # Expected conversion output
└── output/ # Generated output (gitignored)
The content/ directory contains a KB article: How to Migrate Email Templates to Mailtrap - a hands-on guide covering template migration from all 6 providers with syntax comparison tables, before/after code examples, and Mailtrap API examples.
- Python 3.6+
- No external dependencies (stdlib only)