@emailens/cli
v0.3.2
Published
CLI tool for email compatibility analysis — analyze, preview, and export email rendering across 12 email clients.
Maintainers
Readme
@emailens/cli
CLI tool for email compatibility analysis — preview how HTML emails render across 12 email clients (Gmail, Outlook, Apple Mail, Yahoo, Samsung, Thunderbird, HEY, Superhuman).
Install
npm install -g @emailens/cliOr use with npx:
npx @emailens/cli analyze email.htmlCommands
emailens analyze <file>
Analyze CSS compatibility and get per-client scores.
emailens analyze email.html
emailens analyze email.html --clients gmail-web,outlook-windows
emailens analyze email.html --json
cat email.html | emailens analyze -emailens preview <file>
Full preview pipeline: transforms, analysis, dark mode simulation, and optional screenshots.
emailens preview email.html
emailens preview email.html --dark-mode
emailens preview email.html --screenshots --out ./screenshots
emailens preview email.html --jsonemailens export <file>
Export a self-contained HTML or JSON report.
emailens export email.html -o ./report
emailens export email.html --json -o ./report
emailens export email.html --dark-mode --screenshots -o ./reportemailens fix <file>
Generate AI-powered fixes for email compatibility issues. Uses @emailens/engine analysis to build a structured prompt, then calls Claude to fix structural issues (table layouts, VML, MSO conditionals) that static snippets can't handle.
Requires ANTHROPIC_API_KEY environment variable and the optional @anthropic-ai/sdk dependency.
emailens fix email.html # Fix and print to stdout
emailens fix email.html -o fixed.html # Write to file
emailens fix email.html --estimate # Show token estimate only (no AI call)
emailens fix email.html --clients outlook-windows # Scope to one client
emailens fix email.html --json # Full JSON output with metadata
emailens fix email.html --max-tokens 8000 # Limit prompt size
cat email.html | emailens fix - --format jsx # Pipe from stdin| Flag | Alias | Description |
|------|-------|-------------|
| --format | -f | Input format: html, jsx, mjml, maizzle |
| --clients | -c | Comma-separated client IDs to scope the fix |
| --output | -o | Write fixed code to file instead of stdout |
| --json | | Output as JSON (includes token estimates and metadata) |
| --quiet | -q | Suppress spinners and decorations |
| --estimate | | Only show token estimate without calling the AI |
| --max-tokens | | Maximum input tokens for the prompt (default: 16000) |
emailens clients
List all 12 supported email clients.
emailens clients
emailens clients --jsonOptions
All file-processing commands share:
| Flag | Alias | Description |
|------|-------|-------------|
| --format | -f | Input format: html, jsx, mjml, maizzle |
| --clients | -c | Comma-separated client IDs to filter |
| --json | | Output JSON instead of terminal table |
| --quiet | -q | Suppress spinners and decorations |
Preview and export add:
| Flag | Alias | Description |
|------|-------|-------------|
| --dark-mode | -d | Include dark mode simulation |
| --screenshots | | Capture screenshots (requires BROWSERLESS_URL) |
| --out | -o | Output directory |
AI Fixes
The fix command requires an ANTHROPIC_API_KEY environment variable and the @anthropic-ai/sdk package:
npm install @anthropic-ai/sdk
export ANTHROPIC_API_KEY=sk-ant-...Use --estimate to check token usage before making an API call:
emailens fix email.html --estimate
# Input tokens: ~4,200
# Output tokens: ~5,400
# Warnings: 23 (5 structural)Framework Support
The CLI can compile React Email (JSX/TSX), MJML, and Maizzle templates to HTML before analysis. Format is auto-detected from file extension, or specify with --format.
emailens analyze newsletter.tsx # Auto-detected as JSX
emailens analyze template.mjml # Auto-detected as MJML
emailens preview email.html --format maizzle # Explicit formatFramework compilers are optional peer dependencies — install only what you need:
npm install sucrase react @react-email/components @react-email/render # For JSX
npm install mjml # For MJML
npm install @maizzle/framework # For MaizzleScreenshots
Screenshots require a Browserless instance and playwright-core:
npm install playwright-core
export BROWSERLESS_URL=ws://localhost:3000
emailens preview email.html --screenshots --out ./screenshotsPiping
Read from stdin with -:
cat email.html | emailens analyze -
echo '<html><body>Hello</body></html>' | emailens preview - --jsonLicense
MIT
