Build email template systems with React Email or MJML (responsive layouts, dark mode, multi-provider sending) and check rendered HTML for spam risk, client compatibility and Gmail clipping. Use when setting up transactional email, building an email design system, or debugging deliverability of an HTML email file.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Email Template Builder?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/borghei-email-template-builder)
---
name: email-template-builder
description: >
Build email template systems with React Email or MJML (responsive layouts,
dark mode, multi-provider sending) and check rendered HTML for spam risk,
client compatibility and Gmail clipping. Use when setting up transactional
email, building an email design system, or debugging deliverability of an
HTML email file.
license: MIT + Commons Clause
metadata:
version: 1.0.0
author: borghei
category: marketing
domain: email-engineering
tier: POWERFUL
updated: 2026-03-09
frameworks: react-email, mjml, email-deliverability, responsive-email
tags:
- email-templates
- react-email
- mjml
- transactional-email
- deliverability
---
# Email Template Builder
**Tier:** POWERFUL
**Category:** Engineering / Marketing
**Tags:** email templates, React Email, MJML, responsive email, deliverability, transactional email, dark mode
## Overview
Build complete transactional email systems: component-based templates with React Email or MJML, multi-provider sending abstraction, local preview with hot reload, i18n support, dark mode, spam optimization, and UTM tracking. Outputs production-ready code for any major email provider.
This skill builds the email rendering and sending infrastructure. For writing email copy and designing sequences, use email-sequence.
---
## Clarify First
Before building the templates, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
- **Framework:** React Email or MJML, and whether the team uses React/TypeScript (decides the entire codebase; see the decision table below).
- **Templates needed:** welcome, password reset, invoice, trial-expiring, digest, team-invite, etc. (determines which template files to scaffold).
- **Sending provider:** Resend, SendGrid, Postmark, or SES (selects which provider adapter to build).
- **Locales & dark mode:** required languages and dark-mode support (drives the i18n system and base-layout styles).
Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
## Architecture Decision: React Email vs MJML
| Factor | React Email | MJML |
|--------|-----------|------|
| **Component reuse** | Full React component model | Partial (mj-attributes) |
| **TypeScript** | Native | Requires build step |
| **Preview server** | Built-in (`email dev`) | Requires separate setup |
| **Email client compatibility** | Good (renders to tables) | Excellent (battle-tested) |
| **Dark mode** | CSS media queries | CSS media queries |
| **Learning curve** | Low (if you know React) | Low (HTML-like syntax) |
| **Best for** | Teams already using React | Maximum email client compat |
**Recommendation:** React Email for TypeScript teams shipping SaaS. MJML for marketing teams needing maximum compatibility across Outlook, Gmail, Apple Mail, and legacy clients.
---
## Code Reference
Project structure, the base layout component, welcome and invoice templates, the multi-provider send abstraction, UTM injection and the i18n system are in [references/template-code.md](references/template-code.md). Read it when scaffolding.
---
## Deliverability Checklist
### DNS Records (Required)
- [ ] **SPF**: `v=spf1 include:_spf.provider.com ~all` on sending domain
- [ ] **DKIM**: Provider-specific CNAME records configured
- [ ] **DMARC**: `v=DMARC1; p=quarantine; rua=mailto:dmarc@yourdomain.com`
- [ ] **Return-Path**: Matches sending domain (not provider default)
### Content Rules
- [ ] Sender uses own domain (not `@gmail.com`)
- [ ] Subject under 50 characters, no ALL CAPS, no spam triggers
- [ ] Text-to-image ratio: minimum 60% text
- [ ] Plain text version included alongside HTML
- [ ] Unsubscribe link in every email (CAN-SPAM, GDPR, one-click)
- [ ] Physical mailing address in footer (CAN-SPAM requirement)
- [ ] No URL shorteners (use full branded links)
- [ ] Single primary CTA per email
- [ ] All images have alt text
- [ ] HTML validates (no broken/unclosed tags)
### Infrastructure
- [ ] Separate sending domains for transactional vs marketing
- [ ] Warm up new sending domains gradually (start with 50/day, increase 2x weekly)
- [ ] Monitor bounce rates (<2% hard bounces)
- [ ] Process bounces and complaints automatically
- [ ] Test with Mail-Tester.com before production sends (target: 9+/10)
---
## Email Client Compatibility
### Known Quirks
| Client | Quirk | Workaround |
|--------|-------|-----------|
| Outlook (Windows) | No CSS grid/flexbox, ignores margin on images | Use `<table>` layout (React Email handles this) |
| Gmail | Strips `<head>` styles, limits CSS | Inline all styles (React Email handles this) |
| Apple Mail | Best support, renders dark mode well | Standard approach works |
| Yahoo Mail | Limited CSS support | Avoid advanced selectors |
| Outlook.com | Strips background images | Use background-color as fallback |
### Testing Matrix
Test every template on these clients before production:
| Priority | Client | Method |
|----------|--------|--------|
| Critical | Gmail (web) | Send test email |
| Critical | Apple Mail (iOS) | Send test email |
| Critical | Outlook (Windows, latest) | Litmus or Email on Acid |
| High | Outlook.com (web) | Send test email |
| High | Gmail (Android) | Send test email |
| Medium | Yahoo Mail | Litmus |
| Medium | Outlook (Mac) | Send test email |
---
## Dev Workflow
Commands depend on your own project scaffold, which this skill does not ship. Adapt the paths and addresses:
```text
# Preview with hot reload (React Email project): npx email dev --dir <your templates dir> --port 3001
# Export to static HTML for Litmus/Email on Acid: npx email export --dir <your templates dir> --outDir <out dir>
# Send a test: your own send script, to an inbox you control
# Validate the exported HTML with this skill: python3 scripts/template_validator.py <out dir>/welcome.html
```
---
## Common Pitfalls
| Pitfall | Consequence | Prevention |
|---------|-------------|------------|
| Using CSS grid/flexbox | Layout breaks in Outlook | Use `Row`/`Column` from React Email (renders to tables) |
| Container wider than 600px | Breaks on Gmail mobile | Max-width: 600px on container |
| Missing plain text version | Lower deliverability score | Always generate plain text with `render(template, { plainText: true })` |
| Same domain for transactional + marketing | Marketing complaints tank transactional delivery | Separate sending domains/subdomains |
| Skipping email warm-up | Emails go to spam | Start low, increase gradually over 2-4 weeks |
| Dark mode ignoring | Unreadable emails for readers who use a dark theme | Add `prefers-color-scheme: dark` media queries with `!important` |
---
## Related Skills
| Skill | Use When |
|-------|----------|
| **email-sequence** | Writing email copy and designing automation flows |
| **analytics-tracking** | Setting up email engagement tracking and attribution |
| **launch-strategy** | Coordinating email templates for product launches |
---
## Troubleshooting
| Symptom | Likely Cause | Fix |
|---------|-------------|-----|
| Email clipped in Gmail | HTML over 102KB | Run `render_size_analyzer.py`. Remove comments, minify, replace base64 images. |
| Layout broken in Outlook | CSS flexbox/grid used | Use table-based layout. Run `template_validator.py` for compatibility check. |
| Styles stripped in Gmail | Styles in `<head>` only | Inline all CSS. React Email handles this automatically. |
| Unreadable in dark mode | No dark mode CSS | Add `prefers-color-scheme: dark` media queries with `!important`. |
| Low deliverability score | Missing unsubscribe, heavy images | Run `spam_score_checker.py`. Add RFC 8058 one-click unsubscribe headers. |
| Images not loading | Blocked by email client defaults | Add descriptive alt text. Maintain 60%+ text-to-image ratio. |
| Template renders differently across clients | Unsupported CSS properties | Test on Gmail, Apple Mail, Outlook (Windows) before production sends. |
---
## Success Criteria
- Spam score of 9+/10 on mail-tester.com before production sends
- Template renders correctly on Gmail, Apple Mail, and Outlook (Windows)
- HTML under 80KB (well under Gmail's 102KB clip threshold)
- Text-to-image ratio above 60%
- Dark mode tested and readable in Apple Mail, Gmail and Outlook
- All images have alt text and explicit width/height dimensions
- One-click unsubscribe (RFC 8058) implemented in all templates
- Separate sending domains for transactional vs. marketing email
---
## Scope & Limitations
**In Scope:** Email HTML/CSS template engineering, React Email and MJML components, multi-provider sending abstraction, i18n, dark mode, deliverability infrastructure, spam score optimization.
**Out of Scope:** Email copy/sequence writing (use email-sequence), marketing automation workflows, email list management, A/B test statistical analysis.
---
---
## Python Automation Tools
Three checkers read a rendered email HTML file (not React/MJML source; render first with `email export` or `mjml`). All take a file path (or `--input`, or `-` for stdin) and `--format text|json` (`--json` is a legacy alias). `scripts/emailkit.py` is a shared helper, not a command.
| Tool | Checks |
|------|--------|
| `scripts/spam_score_checker.py` | unsubscribe, postal address, preheader, shorteners, alt text, image-heavy mail, trigger phrases, unbalanced tags |
| `scripts/template_validator.py` | doctype/lang/viewport/charset, flex/grid/calc/CSS variables, table layout, inline styles, media queries, 600px width, dark mode |
| `scripts/render_size_analyzer.py` | HTML size vs Gmail's ~102 KB clip, base64 images, comments, whitespace; `--dir` for a folder |
```bash
python3 scripts/spam_score_checker.py assets/flawed_email.html
python3 scripts/template_validator.py assets/sample_email.html --format json
python3 scripts/render_size_analyzer.py --dir assets/size_demo
```
Real output (excerpt, `spam_score_checker.py assets/flawed_email.html`):
```text
spam_score_checker: FIX 14 issues
Read: bytes=980; words=20; images=1; links=1
1. [error] missing-unsubscribe
found: no unsubscribe or preference link in the HTML
limit: at least 1 visible unsubscribe link (CAN-SPAM Act; Google/Yahoo bulk-sender requirements, 2024)
fix: add <a href="{{unsubscribe_url}}">Unsubscribe</a> to the footer and send the List-Unsubscribe ...
```
There is no numeric score: each tool lists findings that quote the template, state the limit and source (or "heuristic"), and give a fix. The three highest-impact fixes are repeated as next actions. The final line is the verdict (`PASS` or `FIX n issues`).
### Exit codes
| Code | Meaning |
|------|---------|
| 0 | no findings |
| 1 | findings to fix |
| 2 | unusable input: file missing, empty, not UTF-8, or plain text with no HTML tags (one-line `BLOCKED:` message on stderr) |
Samples: `assets/sample_email.html` (exit 0), `assets/flawed_email.html` (exit 1), `assets/malformed_email.html` (exit 2); runs are declared in `assets/contract.json`.