CLI
Install and use @emailens/cli to analyze, preview, audit, and lint HTML emails in the terminal.
The @emailens/cli package runs the same @emailens/engine logic locally. No account is required for analyze, preview, audit, or lint. Optional hosted screenshots and share links use the Preview API with an API key.
Input can be HTML, MJML, Maizzle, or React Email (JSX). Format is inferred from the file extension unless you pass --format.
Install
npm install -g @emailens/cliOr run without installing:
npx @emailens/cli analyze ./emails/welcome.htmlRequires Node.js 18+.
Commands
| Command | Purpose |
|---|---|
emailens analyze <file|-> | Per-client compatibility scores and CSS warnings |
emailens lint <file|glob> | CI-friendly unified issue list with exit codes |
emailens preview <file|-> | Full pipeline: transforms, scores, dark mode; optional screenshots |
emailens audit <file|-> | Compatibility plus spam, links, accessibility, images, and related checks |
emailens export <file|-> | Self-contained HTML or JSON report on disk |
emailens fix <file|-> | AI-assisted fixes (requires ANTHROPIC_API_KEY and optional SDK) |
emailens clients | List supported client IDs |
Run emailens --help or emailens <command> --help for the full flag list on your installed version.
analyze
Quick compatibility pass with a score table and grouped warnings.
emailens analyze email.html
emailens analyze email.html --clients gmail-web,outlook-windows
emailens analyze email.html --json
cat email.html | emailens analyze -Source positions (line/column in warnings) are reported for HTML input only. Compiled MJML, JSX, and Maizzle omit positions because line numbers would refer to generated output, not your source file.
lint
Use this in pre-commit hooks and CI. Exit codes:
0, no errors (and no--fail-on-warning/--max-warningsfailure)1, at least one error-severity issue2, warnings only when--fail-on-warningis set, or--max-warningsexceeded
emailens lint 'emails/**/*.html'
emailens lint email.html --json
emailens lint email.html --fail-on-warning
emailens lint email.html --skip spam,linksSee Project config for .emailensrc / package.json emailens rules shared with the VS Code extension.
GitHub Actions
For a dedicated Action with PR annotations, see GitHub Action.
Local lint in a workflow:
- run: npx -y @emailens/cli lint 'emails/**/*.{html,tsx,mjml}' --fail-on-warningpreview
Runs transforms, analysis, and dark-mode simulation. Screenshots and CDN uploads require API credentials when using --screenshots (see CLI --help on your version).
emailens preview email.html
emailens preview email.html --dark-mode
emailens preview email.html --jsonaudit
Single-file comprehensive report (compatibility plus content and deliverability-style checks). Use lint when you need CI exit codes across many files.
emailens audit email.html
emailens audit email.html --json --skip spamShared flags
Most file commands accept:
| Flag | Description |
|---|---|
--format, -f | html, jsx, mjml, maizzle |
--clients, -c | Comma-separated client IDs |
--json | Machine-readable output |
--quiet, -q | No spinners or decorative output |
More detail
Command tables, .emailensrc precedence, and CI examples are also documented in the CLI README on GitHub.