@emailens/engine

中文文档
0.19.1发布于 2026/11/12MITTypeScriptESM + CJS近 30 天下载 3.2万

Email compatibility engine for HTML, MJML, Maizzle and React Email: transforms CSS per email client, scores compatibility, simulates dark mode, suggests fixes, and runs spam, accessibility, link and image quality analysis.

原始使用文档
文档目录10 节
  1. Quick Start
  2. Option 1: Try the CLI first
  3. Option 2: Use the engine as a library
  4. Does it still look like the design?
  5. What It Catches
  6. Measured on real clients
  7. Why Emailens?
  8. Supported Email Clients
  9. Ecosystem
  10. License
emailens / engine

The rendering linter for email

CI npm license tests node MCP GitHub stars

Quick Start · What It Catches · Why Emailens · Supported Clients · API Docs

Your email looks perfect in Apple Mail. Gmail strips half the CSS. Outlook renders it in Word.

@emailens/engine analyzes HTML, React Email, MJML, and Maizzle against 21 email clients and scores compatibility before your email goes out. It catches the issues in the engine, in the terminal, in CI, and inside AI coding workflows.

If you want the fastest path to trying it locally, start with the CLI:

npx @emailens/cli lint email.html

The CLI is the recommended entry point for open-source usage. The engine is the lower-level library for builders, tools, and custom integrations.

emailens.dev is the hosted SaaS for shared previews, screenshots, visual diffs, and team workflows. The open-source packages are the local developer tooling.

Quick Start

Option 1: Try the CLI first

npx @emailens/cli lint email.html

Option 2: Use the engine as a library

npm install @emailens/engine
import { auditEmail } from "@emailens/engine";

const html = `<html><body><div style="display:flex; gap: 12px;">...</div></body></html>`;
const report = auditEmail(html, { framework: "jsx" });

console.log(report.compatibility.scores["outlook-windows"]);

The main entry runs in the browser as well as in Node, and a test keeps it that way. The Node-only parts live in subpaths: @emailens/engine/compile (React Email, MJML and Maizzle compilers) and @emailens/engine/server (DNS and SpamAssassin checks).

Does it still look like the design?

A score counts the code a client supports. @emailens/engine/design judges the render: give it two DOM dumps (the email as designed and as a client drew it) and it says whether the client kept, changed or broke the design, and why in plain words. It also finds image links that are dead for every reader. You supply the render and the network; it supplies the rule.

import { deadImages, explainDesign, keptOf, renderScores, verdictOf } from "@emailens/engine/design";

const kept = keptOf(designNodes, clientNodes);
const verdict = verdictOf(kept, pixelDiff); // "kept" | "changed" | "broken"
explainDesign({ verdict, kept }, "Outlook").sentence;

const dead = await deadImages(html, yourSafeFetcher); // refuse private IPs
renderScores(engineScores, { "outlook-windows-legacy": verdict }, dead.length);

What It Catches

  • CSS compatibility across 21 clients
  • Spam scoring and content hygiene signals
  • Accessibility checks for contrast and semantics
  • Image and link validation
  • Inbox preview and client-specific rendering issues
  • Template variable and overflow problems
  • AI fix generation for structural issues

Every finding may include source positions, so a result can be pointed at, annotated, or fixed in place.

Measured on real clients

Support tables say what a client should do. We send probe emails to the real app and read the result off the screenshot, and where the two disagree, the screenshot wins. Each rule built that way lands with a test holding what the real client did, so you can check our work and rerun it after any change.

BehaviourHow it was measuredTest
Gmail on Android, dark mode880 colour pairs predicted and committed before sending, then read off the real app: 878 within 4/255 per channelgmail-android-dark.test.ts
Outlook for Mac, dark modeA sheet of 223 colour cells, light and dark; the rule is fitted on half the random colours and graded on the other half: 42 of 42 held-out cells within 4/255 (unreleased)outlook-macos-dark.test.ts
Yahoo, Proton and Outlook quirksOne small probe per behaviour, such as Yahoo dropping a quoted font or a radial gradient, or Proton collapsing nbsp spacersyahoo-*.test.ts, protonmail-*.test.ts, outlook-*.test.ts
Support-table correctionsEach cell a real inbox contradicted, with the date it was seenscripts/observed-overrides.ts

It runs in a fraction of a second per email across all 21 clients, so you can check every draft and keep real screenshots for the final send. How the whole loop works, and the blind score against real inboxes: emailens.dev/accuracy.

Why Emailens?

  • Offline-first: runs locally with no account required
  • Unified audit: a single tool checks CSS, spam, accessibility, links, images, and more
  • Framework-aware: works with raw HTML, React Email, MJML, and Maizzle
  • AI-ready: structural fixes can be generated with any model provider
  • Programmable: use it in CI, editors, scripts, or custom tooling

Supported Email Clients

Each client links to its support page on emailens.dev, built from this package's data. Every feature across all 21 clients: emailens.dev/email-css.

ClientID
Gmailgmail-web
Gmail Androidgmail-android
Gmail iOSgmail-ios
Outlook 365outlook-web
Outlook (New)outlook-windows
Outlook Classicoutlook-windows-legacy
Outlook iOSoutlook-ios
Outlook Androidoutlook-android
Outlook for Macoutlook-macos
Apple Mailapple-mail-macos
Apple Mail iOSapple-mail-ios
Yahoo Mailyahoo-mail
Yahoo Mail Androidyahoo-mail-android
Yahoo Mail iOSyahoo-mail-ios
Samsung Mailsamsung-mail
Thunderbirdthunderbird
HEY Mailhey-mail
Proton Mailprotonmail
AOL Mailaol
Fastmailfastmail
Superhumansuperhuman

Ecosystem

PackageUse it for
@emailens/engineCore library and analysis API
@emailens/cliLint locally and in CI
@emailens/mcpAI agent access to email QA
emailens/actionGitHub Action quality gate
emailens/vscodeVS Code linting and preview
emailens.devHosted previews and team workflows

License

MIT, Copyright 2025 Emailens


If this saved you from an Outlook surprise, a star helps other email developers find it.

版本与发布记录

@emailens/engine 共发布 98 个版本,首次发布于 2026/02/26;过去 12 个月发布了 98 个版本。

版本发布日期距今
0.19.1latest2026/11/121 天前
0.19.02026/11/121 天前
0.18.222026/11/112 天前
0.18.212026/11/094 天前
0.18.202026/11/067 天前
0.18.192026/11/067 天前

关于 @emailens/engine 的常见问题

@emailens/engine 是什么?

Email compatibility engine for HTML, MJML, Maizzle and React Email: transforms CSS per email client, scores compatibility, simulates dark mode, suggests fixes, and runs spam, accessibility, link and image quality analysis.

如何安装 @emailens/engine?

在项目目录运行 npm install @emailens/engine,或使用 pnpm add / yarn add / bun add。

@emailens/engine 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@emailens/engine 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@emailens/engine 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@emailens/engine 可以商用吗?

@emailens/engine 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@emailens/engine 的下载量有多少?

根据 npm 官方下载统计,@emailens/engine 在 2026/10/14 – 2026/11/12 这 30 天内被下载 32,353 次,日均约 1,078 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@emailens/engine 还在维护吗?

最新版本 0.19.1 发布于 2026/11/12(1 天前);至今共发布 98 个版本,其中过去 12 个月发布了 98 个;首次发布于 2026/02/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。