doiuse-email
raw JSON → 0.4.1 verified Fri May 01 auth: no javascript
Lint CSS and HTML for email client support against the Can I Email database. v0.4.1 is the latest stable release, with slow release cadence. Key differentiators: programmatic API and CLI, TypeScript types included, supports flexible client selection via glob patterns. Unlike other tools, it uses the same data source as caniemail.com and is inspired by doiuse for web browser support.
Common errors
error Error: Cannot find module 'doiuse-email' ↓
cause Package not installed or import path is wrong (e.g., using require in ESM-only package).
fix
Run 'npm install doiuse-email'. Use 'import { doIUseEmail } from 'doiuse-email' instead of require.
error TypeError: doIUseEmail is not a function ↓
cause Using default import incorrectly. The package only exports named exports.
fix
Change 'import doiuse from 'doiuse-email'' to 'import { doIUseEmail } from 'doiuse-email''.
error SyntaxError: Unexpected token 'export' ↓
cause Using CommonJS require in an ESM-only package.
fix
Use ES module import syntax. Alternatively, set 'type': 'module' in package.json or use .mjs extension.
Warnings
breaking Requires Node.js 12 or later. Older Node versions cause errors. ↓
fix Upgrade Node.js to 12+ or use an older version of this package if needed.
deprecated The default export is deprecated in favor of named export 'doIUseEmail'. ↓
fix Use import { doIUseEmail } from 'doiuse-email' instead of import doiuse from 'doiuse-email'.
breaking CLI output format changed from an object with 'success' and 'notes' to a flat JSON array in v0.4.0. ↓
fix Update scripts that parse CLI output to expect an array of note objects instead of the previous object shape.
gotcha Only inline CSS is supported; external stylesheets are not checked. ↓
fix Ensure all CSS is inline within the HTML string passed to doIUseEmail.
Install
npm install doiuse-email yarn add doiuse-email pnpm add doiuse-email Imports
- doIUseEmail wrong
const doIUseEmail = require('doiuse-email')correctimport { doIUseEmail } from 'doiuse-email' - DoIUseOptions wrong
nonecorrectimport { DoIUseOptions } from 'doiuse-email' - DoIUseResult
import { DoIUseResult } from 'doiuse-email'
Quickstart
import { doIUseEmail } from 'doiuse-email';
const html = `
<!DOCTYPE html>
<html>
<body>
<div style="background-color: orange;"></div>
</body>
</html>
`;
const result = doIUseEmail(html, {
emailClients: ['gmail.*'],
});
console.log(result.success);
// true if no unsupported features, false otherwise
console.log(result.notes);
// Array of notes about support status per client