Emailens
CLI

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/cli

Or run without installing:

npx @emailens/cli analyze ./emails/welcome.html

Requires Node.js 18+.

Commands

CommandPurpose
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 clientsList 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-warnings failure)
  • 1, at least one error-severity issue
  • 2, warnings only when --fail-on-warning is set, or --max-warnings exceeded
emailens lint 'emails/**/*.html'
emailens lint email.html --json
emailens lint email.html --fail-on-warning
emailens lint email.html --skip spam,links

See 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-warning

preview

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 --json

audit

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 spam

Shared flags

Most file commands accept:

FlagDescription
--format, -fhtml, jsx, mjml, maizzle
--clients, -cComma-separated client IDs
--jsonMachine-readable output
--quiet, -qNo spinners or decorative output

More detail

Command tables, .emailensrc precedence, and CI examples are also documented in the CLI README on GitHub.

On this page