@mscode-pl/email-lint 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +274 -274
- package/data/LICENSE-caniemail +21 -21
- package/dist/cli/main.js +27 -27
- package/package.json +71 -71
- package/skills/email-lint/SKILL.md +68 -68
- package/skills/email-lint/references/fixes.md +58 -58
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 MSCode
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MSCode
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,274 +1,274 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset=".github/banner-dark.svg">
|
|
4
|
-
<img src=".github/banner-light.svg" alt="email-lint: find what Outlook will break before you hit send" width="100%">
|
|
5
|
-
</picture>
|
|
6
|
-
</p>
|
|
7
|
-
|
|
8
|
-
<p align="center">
|
|
9
|
-
<a href="https://www.npmjs.com/package/@mscode-pl/email-lint"><img src="https://badges.mscode.pl/npm/v/@mscode-pl/email-lint" alt="npm version"></a>
|
|
10
|
-
<a href="https://www.npmjs.com/package/@mscode-pl/email-lint"><img src="https://badges.mscode.pl/npm/dm/@mscode-pl/email-lint" alt="npm downloads"></a>
|
|
11
|
-
<a href="https://github.com/mscode-pl/email-lint/actions/workflows/ci.yml"><img src="https://badges.mscode.pl/github/actions/mscode-pl/email-lint/ci.yml?branch=master&label=tests" alt="Tests"></a>
|
|
12
|
-
<img src="https://badges.mscode.pl/badge/node/22+/339933?icon=nodejs" alt="Node 22+">
|
|
13
|
-
<a href="LICENSE"><img src="https://badges.mscode.pl/npm/l/@mscode-pl/email-lint" alt="License"></a>
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
<p align="center">
|
|
17
|
-
email-lint reads your email HTML and points at every CSS property, selector, HTML element and image format that Gmail, Outlook, Apple Mail, Yahoo and 18 other clients do not support, with the line it is on. The support data comes from <a href="https://www.caniemail.com">caniemail.com</a> and ships with the package, so it runs offline and in CI.
|
|
18
|
-
</p>
|
|
19
|
-
|
|
20
|
-
<p align="center">
|
|
21
|
-
<a href="#try-it">Try it</a> · <a href="#works-with-your-stack">Stacks</a> · <a href="#use-it-in-ci">CI</a> · <a href="#options">Options</a> · <a href="#use-it-from-code">API</a> · <a href="#use-it-from-an-ai-agent">AI agents</a>
|
|
22
|
-
</p>
|
|
23
|
-
|
|
24
|
-
<p align="center">
|
|
25
|
-
<img src="docs/screenshot.svg" alt="email-lint output: display:flex, gap and border-radius flagged as unsupported in Outlook for Windows, each with its line number" width="920">
|
|
26
|
-
</p>
|
|
27
|
-
|
|
28
|
-
## Try it
|
|
29
|
-
|
|
30
|
-
Run it with no arguments and it walks you through the check: it finds the HTML in your project, asks which clients matter, shows the results and can save a report.
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
npx @mscode-pl/email-lint
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Or check a folder in one command:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npx @mscode-pl/email-lint emails/
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
It needs Node 22 or newer, no account and no API key, and it sends nothing over the network.
|
|
43
|
-
|
|
44
|
-
## Why
|
|
45
|
-
|
|
46
|
-
Email clients render a small and uneven slice of CSS. Outlook for Windows still uses Word to draw HTML, so `display: flex`, `border-radius` and `max-width` on a `<div>` quietly do nothing there. Gmail drops your `<style>` block for some accounts. The usual way to find out is a customer screenshot, or a paid rendering service on every change.
|
|
47
|
-
|
|
48
|
-
caniemail.com already tracks which client supports what. email-lint applies that table to your actual templates, so the answer is a list of lines to fix instead of 308 feature pages to read.
|
|
49
|
-
|
|
50
|
-
## What you get
|
|
51
|
-
|
|
52
|
-
| Feature | Details |
|
|
53
|
-
| --- | --- |
|
|
54
|
-
| **Line numbers for every problem** | In inline styles, `<style>` blocks and attributes alike. |
|
|
55
|
-
| **306 of 308 caniemail features** | CSS properties and values, selectors and pseudo-classes, at-rules and media features, units and functions, HTML elements and attributes, image formats. BIMI and HDR images cannot be seen in HTML. |
|
|
56
|
-
| **Errors that mean something** | An error is a feature at least one of your clients does not support at all. A warning is partial support, and `--verbose` prints caniemail's note on what is missing. |
|
|
57
|
-
| **Outlook conditionals understood** | Content inside `<!--[if !mso]><!-->` is hidden from Outlook for Windows, so it is not blamed for it. That is the hybrid layout most email frameworks generate. |
|
|
58
|
-
| **Low noise by default** | `<body>`, `<style>`, tables, class selectors, `role` and `aria-*` are not reported, because the only fix would be removing them. `--strict` shows everything. |
|
|
59
|
-
| **Reports you can share** | Markdown for a pull request, JSON for scripts, GitHub annotations on the pull request. |
|
|
60
|
-
| **GitHub Action and MCP server** | One pull request comment that updates itself, and two tools your AI agent can call while it writes the email. |
|
|
61
|
-
|
|
62
|
-
## Works with your stack
|
|
63
|
-
|
|
64
|
-
email-lint checks rendered HTML, so it works with any tool that produces it:
|
|
65
|
-
|
|
66
|
-
| Stack | Command |
|
|
67
|
-
| --- | --- |
|
|
68
|
-
| Plain HTML | `npx @mscode-pl/email-lint emails/` |
|
|
69
|
-
| React Email | `npx email export --outDir out && npx @mscode-pl/email-lint out/` |
|
|
70
|
-
| MJML | `npx mjml "emails/*.mjml" -o out/ && npx @mscode-pl/email-lint out/` |
|
|
71
|
-
| Maizzle | `npx maizzle build production`, then lint the output folder |
|
|
72
|
-
| [laravel-react-email](https://github.com/mscode-pl/laravel-react-email) | `php artisan react-email:build && npx @mscode-pl/email-lint "resources/views/react-email/**/*.blade.php"` |
|
|
73
|
-
|
|
74
|
-
Blade syntax such as `{{ $name }}` and `@if` is read as text and does not trigger false reports.
|
|
75
|
-
|
|
76
|
-
## Pick your clients
|
|
77
|
-
|
|
78
|
-
The default set is Gmail, Outlook, Apple Mail, Yahoo, Samsung Email and Thunderbird. Narrow it down to what your audience uses:
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
email-lint emails/ --clients gmail,apple-mail # consumer newsletter
|
|
82
|
-
email-lint emails/ --clients outlook.windows # one platform of one client
|
|
83
|
-
email-lint emails/ --clients all # every client caniemail tests
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
A typo fails with the list of valid names instead of silently checking nothing.
|
|
87
|
-
|
|
88
|
-
<details>
|
|
89
|
-
<summary>All 22 clients</summary>
|
|
90
|
-
|
|
91
|
-
`gmail`, `outlook`, `apple-mail`, `yahoo`, `samsung-email`, `thunderbird`, `protonmail`, `fastmail`, `hey`, `aol`, `wp-pl`, `gmx`, `web-de`, `t-online-de`, `orange`, `sfr`, `free-fr`, `laposte`, `mail-ru`, `ionos-1and1`, `rainloop`, `microsoft`
|
|
92
|
-
|
|
93
|
-
</details>
|
|
94
|
-
|
|
95
|
-
## Use it in CI
|
|
96
|
-
|
|
97
|
-
Commit a config file so everyone on the team runs the same check:
|
|
98
|
-
|
|
99
|
-
```json
|
|
100
|
-
{
|
|
101
|
-
"files": ["emails/**/*.html"],
|
|
102
|
-
"clients": ["gmail", "outlook", "apple-mail"],
|
|
103
|
-
"ignore": ["css-border-radius"],
|
|
104
|
-
"failOn": "error"
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Save it as `email-lint.config.json`, and `email-lint` with no arguments uses it. The interactive mode can write it for you.
|
|
109
|
-
|
|
110
|
-
### GitHub Action
|
|
111
|
-
|
|
112
|
-
The action marks every finding on the line it is on in the pull request diff, and posts the full report as one comment that it updates on every push instead of adding a new one. When the issues are fixed, the comment says so.
|
|
113
|
-
|
|
114
|
-
```yaml
|
|
115
|
-
name: Emails
|
|
116
|
-
|
|
117
|
-
on: pull_request
|
|
118
|
-
|
|
119
|
-
permissions:
|
|
120
|
-
contents: read
|
|
121
|
-
pull-requests: write
|
|
122
|
-
|
|
123
|
-
jobs:
|
|
124
|
-
email-lint:
|
|
125
|
-
runs-on: ubuntu-latest
|
|
126
|
-
steps:
|
|
127
|
-
- uses: actions/checkout@v4
|
|
128
|
-
# Build your templates first, e.g. npx email export --outDir out
|
|
129
|
-
- uses: mscode-pl/email-lint@v1
|
|
130
|
-
with:
|
|
131
|
-
files: out
|
|
132
|
-
clients: gmail,outlook,apple-mail
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
| Input | Default | |
|
|
136
|
-
| --- | --- | --- |
|
|
137
|
-
| `files` | `files` from the config | Files, folders or globs, separated by spaces or new lines |
|
|
138
|
-
| `clients` | config, then the defaults | Comma separated, e.g. `gmail,outlook.windows` |
|
|
139
|
-
| `ignore` | | Feature slugs to skip, comma separated |
|
|
140
|
-
| `strict` | `false` | Also report baseline features |
|
|
141
|
-
| `fail-on` | config, then `error` | `error`, `warning` or `never` |
|
|
142
|
-
| `config` | `email-lint.config.json` | Config file to read |
|
|
143
|
-
| `comment` | `true` | Post the report as a pull request comment |
|
|
144
|
-
| `github-token` | `github.token` | Token for the comment |
|
|
145
|
-
| `version` | the action's release | email-lint version from npm |
|
|
146
|
-
|
|
147
|
-
Outputs: `report` (path to the Markdown report, also shown in the job summary) and `exit-code`. The step needs Node 22; on an older runner the action installs it. Pull requests from forks get a read-only token, so they get the annotations and the job summary but no comment. GitHub shows at most 10 annotations of each level per step, and the comment lists the rest.
|
|
148
|
-
|
|
149
|
-
### Any other CI
|
|
150
|
-
|
|
151
|
-
`--format github` prints GitHub annotations, `-o report.md` saves a Markdown report:
|
|
152
|
-
|
|
153
|
-
```yaml
|
|
154
|
-
- run: npx @mscode-pl/email-lint --format github -o email-report.md
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
The exit code is `1` when there are errors (or warnings with `--fail-on warning`), `0` otherwise, and `2` for bad arguments or no matching files.
|
|
158
|
-
|
|
159
|
-
## Options
|
|
160
|
-
|
|
161
|
-
| Option | Default | |
|
|
162
|
-
| --- | --- | --- |
|
|
163
|
-
| `-c, --clients <list>` | see above | Clients to check |
|
|
164
|
-
| `-i, --ignore <list>` | | Feature slugs to skip, e.g. `css-display-flex` |
|
|
165
|
-
| `--strict` | off | Also report baseline features and Gmail in a mobile browser |
|
|
166
|
-
| `-f, --format <type>` | `text` | `text`, `json`, `markdown` or `github` |
|
|
167
|
-
| `-o, --output <file>` | | Also save a full report; `.json` and `.md` pick the format |
|
|
168
|
-
| `--verbose` / `-q, --quiet` | off | caniemail notes and links / errors only |
|
|
169
|
-
| `--fail-on <level>` | `error` | `error`, `warning` or `never` |
|
|
170
|
-
| `--config <file>` | `email-lint.config.json` | Config file to read |
|
|
171
|
-
| `--stdin` | | Read HTML from stdin |
|
|
172
|
-
|
|
173
|
-
## Use it from code
|
|
174
|
-
|
|
175
|
-
```ts
|
|
176
|
-
import { lint } from '@mscode-pl/email-lint';
|
|
177
|
-
|
|
178
|
-
const { issues, errors } = lint(html, { clients: ['gmail', 'outlook'] });
|
|
179
|
-
|
|
180
|
-
for (const issue of issues) {
|
|
181
|
-
console.log(issue.lines, issue.level, issue.title, issue.clients);
|
|
182
|
-
}
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
`lint` is synchronous and does no I/O beyond reading the bundled dataset once. Every issue carries the caniemail slug, its URL, the affected lines and, per client and platform, the support status and notes.
|
|
186
|
-
|
|
187
|
-
## Use it from an AI agent
|
|
188
|
-
|
|
189
|
-
### MCP server
|
|
190
|
-
|
|
191
|
-
`email-lint mcp` starts an [MCP](https://modelcontextprotocol.io) server on stdio, so Claude, Cursor, VS Code and other MCP clients can check a template while they write it. It has two read-only tools:
|
|
192
|
-
|
|
193
|
-
| Tool | What it does |
|
|
194
|
-
| --- | --- |
|
|
195
|
-
| `lint_email` | Lints `html` passed inline or a `path` (file, folder or glob) and returns every issue with its line, the affected clients and caniemail's notes. With neither, it lints the files from `email-lint.config.json`. |
|
|
196
|
-
| `explain_feature` | For one slug, says which clients lack support, whether that breaks the email or only drops decoration, and how to fix it. |
|
|
197
|
-
|
|
198
|
-
Paths are relative to the folder the client starts the server in, usually your project, and `email-lint.config.json` there sets the default clients and ignored features.
|
|
199
|
-
|
|
200
|
-
Claude Code:
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
claude mcp add email-lint -- npx -y @mscode-pl/email-lint mcp
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
Cursor, VS Code, Claude Desktop and others take the same command in their MCP config:
|
|
207
|
-
|
|
208
|
-
```json
|
|
209
|
-
{
|
|
210
|
-
"mcpServers": {
|
|
211
|
-
"email-lint": {
|
|
212
|
-
"command": "npx",
|
|
213
|
-
"args": ["-y", "@mscode-pl/email-lint", "mcp"]
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
To lint a folder that is named `mcp`, write it as `./mcp`.
|
|
220
|
-
|
|
221
|
-
### Agent Skill
|
|
222
|
-
|
|
223
|
-
The repo ships an [Agent Skill](skills/email-lint/SKILL.md) for Claude Code, Codex, Cursor and other agents. It runs email-lint on your templates, sorts the findings into must-fix and acceptable degradation, and proposes fixes in your source files (a table instead of flexbox, VML for rounded Outlook buttons, PNG instead of WebP).
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
npx skills add mscode-pl/email-lint
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
## How support is judged
|
|
230
|
-
|
|
231
|
-
- Each client platform (Gmail on iOS, Outlook on Windows) is judged by the newest version caniemail tested.
|
|
232
|
-
- Gmail opened in a mobile browser is left out by default. It drops `<style>` entirely and would flag nearly every email; name it with `--clients gmail.mobile-webmail` to include it.
|
|
233
|
-
- email-lint reads markup, it does not render it. It tells you a feature is used where a client ignores it, not how the result looks. For pixel checks you still need a real client or a rendering service.
|
|
234
|
-
|
|
235
|
-
## Updating the data
|
|
236
|
-
|
|
237
|
-
The dataset in `data/caniemail.json` is a trimmed copy of caniemail's API, dated in `email-lint --version`. To refresh it:
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
pnpm update-data
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
## Contributing
|
|
244
|
-
|
|
245
|
-
```bash
|
|
246
|
-
pnpm install
|
|
247
|
-
pnpm test
|
|
248
|
-
pnpm build && node dist/cli/main.js examples
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
`pnpm screenshot` regenerates `docs/screenshot.svg` from the real CLI output.
|
|
252
|
-
|
|
253
|
-
## License
|
|
254
|
-
|
|
255
|
-
MIT. Support data from [caniemail](https://github.com/hteumeuleu/caniemail) by Rémi Parmentier, MIT License, see [data/LICENSE-caniemail](data/LICENSE-caniemail).
|
|
256
|
-
|
|
257
|
-
---
|
|
258
|
-
|
|
259
|
-
<p align="center">
|
|
260
|
-
<a href="https://mscode.pl">
|
|
261
|
-
<picture>
|
|
262
|
-
<source media="(prefers-color-scheme: dark)" srcset=".github/mscode-logo-white.svg">
|
|
263
|
-
<img src=".github/mscode-logo-black.svg" alt="MSCode" height="28">
|
|
264
|
-
</picture>
|
|
265
|
-
</a>
|
|
266
|
-
</p>
|
|
267
|
-
|
|
268
|
-
<p align="center">
|
|
269
|
-
Built and maintained by <a href="https://mscode.pl">MSCode</a>, a Polish software house that makes websites and web and mobile apps.
|
|
270
|
-
</p>
|
|
271
|
-
|
|
272
|
-
<p align="center">
|
|
273
|
-
<a href="https://mscode.pl">mscode.pl</a> · <a href="https://github.com/mscode-pl">More packages</a> · <a href="https://github.com/mscode-pl/email-lint/issues">Report an issue</a>
|
|
274
|
-
</p>
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset=".github/banner-dark.svg">
|
|
4
|
+
<img src=".github/banner-light.svg" alt="email-lint: find what Outlook will break before you hit send" width="100%">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://www.npmjs.com/package/@mscode-pl/email-lint"><img src="https://badges.mscode.pl/npm/v/@mscode-pl/email-lint" alt="npm version"></a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/@mscode-pl/email-lint"><img src="https://badges.mscode.pl/npm/dm/@mscode-pl/email-lint" alt="npm downloads"></a>
|
|
11
|
+
<a href="https://github.com/mscode-pl/email-lint/actions/workflows/ci.yml"><img src="https://badges.mscode.pl/github/actions/mscode-pl/email-lint/ci.yml?branch=master&label=tests" alt="Tests"></a>
|
|
12
|
+
<img src="https://badges.mscode.pl/badge/node/22+/339933?icon=nodejs" alt="Node 22+">
|
|
13
|
+
<a href="LICENSE"><img src="https://badges.mscode.pl/npm/l/@mscode-pl/email-lint" alt="License"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
email-lint reads your email HTML and points at every CSS property, selector, HTML element and image format that Gmail, Outlook, Apple Mail, Yahoo and 18 other clients do not support, with the line it is on. The support data comes from <a href="https://www.caniemail.com">caniemail.com</a> and ships with the package, so it runs offline and in CI.
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="#try-it">Try it</a> · <a href="#works-with-your-stack">Stacks</a> · <a href="#use-it-in-ci">CI</a> · <a href="#options">Options</a> · <a href="#use-it-from-code">API</a> · <a href="#use-it-from-an-ai-agent">AI agents</a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
<p align="center">
|
|
25
|
+
<img src="docs/screenshot.svg" alt="email-lint output: display:flex, gap and border-radius flagged as unsupported in Outlook for Windows, each with its line number" width="920">
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
## Try it
|
|
29
|
+
|
|
30
|
+
Run it with no arguments and it walks you through the check: it finds the HTML in your project, asks which clients matter, shows the results and can save a report.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx @mscode-pl/email-lint
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or check a folder in one command:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx @mscode-pl/email-lint emails/
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
It needs Node 22 or newer, no account and no API key, and it sends nothing over the network.
|
|
43
|
+
|
|
44
|
+
## Why
|
|
45
|
+
|
|
46
|
+
Email clients render a small and uneven slice of CSS. Outlook for Windows still uses Word to draw HTML, so `display: flex`, `border-radius` and `max-width` on a `<div>` quietly do nothing there. Gmail drops your `<style>` block for some accounts. The usual way to find out is a customer screenshot, or a paid rendering service on every change.
|
|
47
|
+
|
|
48
|
+
caniemail.com already tracks which client supports what. email-lint applies that table to your actual templates, so the answer is a list of lines to fix instead of 308 feature pages to read.
|
|
49
|
+
|
|
50
|
+
## What you get
|
|
51
|
+
|
|
52
|
+
| Feature | Details |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| **Line numbers for every problem** | In inline styles, `<style>` blocks and attributes alike. |
|
|
55
|
+
| **306 of 308 caniemail features** | CSS properties and values, selectors and pseudo-classes, at-rules and media features, units and functions, HTML elements and attributes, image formats. BIMI and HDR images cannot be seen in HTML. |
|
|
56
|
+
| **Errors that mean something** | An error is a feature at least one of your clients does not support at all. A warning is partial support, and `--verbose` prints caniemail's note on what is missing. |
|
|
57
|
+
| **Outlook conditionals understood** | Content inside `<!--[if !mso]><!-->` is hidden from Outlook for Windows, so it is not blamed for it. That is the hybrid layout most email frameworks generate. |
|
|
58
|
+
| **Low noise by default** | `<body>`, `<style>`, tables, class selectors, `role` and `aria-*` are not reported, because the only fix would be removing them. `--strict` shows everything. |
|
|
59
|
+
| **Reports you can share** | Markdown for a pull request, JSON for scripts, GitHub annotations on the pull request. |
|
|
60
|
+
| **GitHub Action and MCP server** | One pull request comment that updates itself, and two tools your AI agent can call while it writes the email. |
|
|
61
|
+
|
|
62
|
+
## Works with your stack
|
|
63
|
+
|
|
64
|
+
email-lint checks rendered HTML, so it works with any tool that produces it:
|
|
65
|
+
|
|
66
|
+
| Stack | Command |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| Plain HTML | `npx @mscode-pl/email-lint emails/` |
|
|
69
|
+
| React Email | `npx email export --outDir out && npx @mscode-pl/email-lint out/` |
|
|
70
|
+
| MJML | `npx mjml "emails/*.mjml" -o out/ && npx @mscode-pl/email-lint out/` |
|
|
71
|
+
| Maizzle | `npx maizzle build production`, then lint the output folder |
|
|
72
|
+
| [laravel-react-email](https://github.com/mscode-pl/laravel-react-email) | `php artisan react-email:build && npx @mscode-pl/email-lint "resources/views/react-email/**/*.blade.php"` |
|
|
73
|
+
|
|
74
|
+
Blade syntax such as `{{ $name }}` and `@if` is read as text and does not trigger false reports.
|
|
75
|
+
|
|
76
|
+
## Pick your clients
|
|
77
|
+
|
|
78
|
+
The default set is Gmail, Outlook, Apple Mail, Yahoo, Samsung Email and Thunderbird. Narrow it down to what your audience uses:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
email-lint emails/ --clients gmail,apple-mail # consumer newsletter
|
|
82
|
+
email-lint emails/ --clients outlook.windows # one platform of one client
|
|
83
|
+
email-lint emails/ --clients all # every client caniemail tests
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
A typo fails with the list of valid names instead of silently checking nothing.
|
|
87
|
+
|
|
88
|
+
<details>
|
|
89
|
+
<summary>All 22 clients</summary>
|
|
90
|
+
|
|
91
|
+
`gmail`, `outlook`, `apple-mail`, `yahoo`, `samsung-email`, `thunderbird`, `protonmail`, `fastmail`, `hey`, `aol`, `wp-pl`, `gmx`, `web-de`, `t-online-de`, `orange`, `sfr`, `free-fr`, `laposte`, `mail-ru`, `ionos-1and1`, `rainloop`, `microsoft`
|
|
92
|
+
|
|
93
|
+
</details>
|
|
94
|
+
|
|
95
|
+
## Use it in CI
|
|
96
|
+
|
|
97
|
+
Commit a config file so everyone on the team runs the same check:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"files": ["emails/**/*.html"],
|
|
102
|
+
"clients": ["gmail", "outlook", "apple-mail"],
|
|
103
|
+
"ignore": ["css-border-radius"],
|
|
104
|
+
"failOn": "error"
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Save it as `email-lint.config.json`, and `email-lint` with no arguments uses it. The interactive mode can write it for you.
|
|
109
|
+
|
|
110
|
+
### GitHub Action
|
|
111
|
+
|
|
112
|
+
The action marks every finding on the line it is on in the pull request diff, and posts the full report as one comment that it updates on every push instead of adding a new one. When the issues are fixed, the comment says so.
|
|
113
|
+
|
|
114
|
+
```yaml
|
|
115
|
+
name: Emails
|
|
116
|
+
|
|
117
|
+
on: pull_request
|
|
118
|
+
|
|
119
|
+
permissions:
|
|
120
|
+
contents: read
|
|
121
|
+
pull-requests: write
|
|
122
|
+
|
|
123
|
+
jobs:
|
|
124
|
+
email-lint:
|
|
125
|
+
runs-on: ubuntu-latest
|
|
126
|
+
steps:
|
|
127
|
+
- uses: actions/checkout@v4
|
|
128
|
+
# Build your templates first, e.g. npx email export --outDir out
|
|
129
|
+
- uses: mscode-pl/email-lint@v1
|
|
130
|
+
with:
|
|
131
|
+
files: out
|
|
132
|
+
clients: gmail,outlook,apple-mail
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
| Input | Default | |
|
|
136
|
+
| --- | --- | --- |
|
|
137
|
+
| `files` | `files` from the config | Files, folders or globs, separated by spaces or new lines |
|
|
138
|
+
| `clients` | config, then the defaults | Comma separated, e.g. `gmail,outlook.windows` |
|
|
139
|
+
| `ignore` | | Feature slugs to skip, comma separated |
|
|
140
|
+
| `strict` | `false` | Also report baseline features |
|
|
141
|
+
| `fail-on` | config, then `error` | `error`, `warning` or `never` |
|
|
142
|
+
| `config` | `email-lint.config.json` | Config file to read |
|
|
143
|
+
| `comment` | `true` | Post the report as a pull request comment |
|
|
144
|
+
| `github-token` | `github.token` | Token for the comment |
|
|
145
|
+
| `version` | the action's release | email-lint version from npm |
|
|
146
|
+
|
|
147
|
+
Outputs: `report` (path to the Markdown report, also shown in the job summary) and `exit-code`. The step needs Node 22; on an older runner the action installs it. Pull requests from forks get a read-only token, so they get the annotations and the job summary but no comment. GitHub shows at most 10 annotations of each level per step, and the comment lists the rest.
|
|
148
|
+
|
|
149
|
+
### Any other CI
|
|
150
|
+
|
|
151
|
+
`--format github` prints GitHub annotations, `-o report.md` saves a Markdown report:
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
- run: npx @mscode-pl/email-lint --format github -o email-report.md
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The exit code is `1` when there are errors (or warnings with `--fail-on warning`), `0` otherwise, and `2` for bad arguments or no matching files.
|
|
158
|
+
|
|
159
|
+
## Options
|
|
160
|
+
|
|
161
|
+
| Option | Default | |
|
|
162
|
+
| --- | --- | --- |
|
|
163
|
+
| `-c, --clients <list>` | see above | Clients to check |
|
|
164
|
+
| `-i, --ignore <list>` | | Feature slugs to skip, e.g. `css-display-flex` |
|
|
165
|
+
| `--strict` | off | Also report baseline features and Gmail in a mobile browser |
|
|
166
|
+
| `-f, --format <type>` | `text` | `text`, `json`, `markdown` or `github` |
|
|
167
|
+
| `-o, --output <file>` | | Also save a full report; `.json` and `.md` pick the format |
|
|
168
|
+
| `--verbose` / `-q, --quiet` | off | caniemail notes and links / errors only |
|
|
169
|
+
| `--fail-on <level>` | `error` | `error`, `warning` or `never` |
|
|
170
|
+
| `--config <file>` | `email-lint.config.json` | Config file to read |
|
|
171
|
+
| `--stdin` | | Read HTML from stdin |
|
|
172
|
+
|
|
173
|
+
## Use it from code
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
import { lint } from '@mscode-pl/email-lint';
|
|
177
|
+
|
|
178
|
+
const { issues, errors } = lint(html, { clients: ['gmail', 'outlook'] });
|
|
179
|
+
|
|
180
|
+
for (const issue of issues) {
|
|
181
|
+
console.log(issue.lines, issue.level, issue.title, issue.clients);
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`lint` is synchronous and does no I/O beyond reading the bundled dataset once. Every issue carries the caniemail slug, its URL, the affected lines and, per client and platform, the support status and notes.
|
|
186
|
+
|
|
187
|
+
## Use it from an AI agent
|
|
188
|
+
|
|
189
|
+
### MCP server
|
|
190
|
+
|
|
191
|
+
`email-lint mcp` starts an [MCP](https://modelcontextprotocol.io) server on stdio, so Claude, Cursor, VS Code and other MCP clients can check a template while they write it. It has two read-only tools:
|
|
192
|
+
|
|
193
|
+
| Tool | What it does |
|
|
194
|
+
| --- | --- |
|
|
195
|
+
| `lint_email` | Lints `html` passed inline or a `path` (file, folder or glob) and returns every issue with its line, the affected clients and caniemail's notes. With neither, it lints the files from `email-lint.config.json`. |
|
|
196
|
+
| `explain_feature` | For one slug, says which clients lack support, whether that breaks the email or only drops decoration, and how to fix it. |
|
|
197
|
+
|
|
198
|
+
Paths are relative to the folder the client starts the server in, usually your project, and `email-lint.config.json` there sets the default clients and ignored features.
|
|
199
|
+
|
|
200
|
+
Claude Code:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
claude mcp add email-lint -- npx -y @mscode-pl/email-lint mcp
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Cursor, VS Code, Claude Desktop and others take the same command in their MCP config:
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"mcpServers": {
|
|
211
|
+
"email-lint": {
|
|
212
|
+
"command": "npx",
|
|
213
|
+
"args": ["-y", "@mscode-pl/email-lint", "mcp"]
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
To lint a folder that is named `mcp`, write it as `./mcp`.
|
|
220
|
+
|
|
221
|
+
### Agent Skill
|
|
222
|
+
|
|
223
|
+
The repo ships an [Agent Skill](skills/email-lint/SKILL.md) for Claude Code, Codex, Cursor and other agents. It runs email-lint on your templates, sorts the findings into must-fix and acceptable degradation, and proposes fixes in your source files (a table instead of flexbox, VML for rounded Outlook buttons, PNG instead of WebP).
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
npx skills add mscode-pl/email-lint
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## How support is judged
|
|
230
|
+
|
|
231
|
+
- Each client platform (Gmail on iOS, Outlook on Windows) is judged by the newest version caniemail tested.
|
|
232
|
+
- Gmail opened in a mobile browser is left out by default. It drops `<style>` entirely and would flag nearly every email; name it with `--clients gmail.mobile-webmail` to include it.
|
|
233
|
+
- email-lint reads markup, it does not render it. It tells you a feature is used where a client ignores it, not how the result looks. For pixel checks you still need a real client or a rendering service.
|
|
234
|
+
|
|
235
|
+
## Updating the data
|
|
236
|
+
|
|
237
|
+
The dataset in `data/caniemail.json` is a trimmed copy of caniemail's API, dated in `email-lint --version`. To refresh it:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
pnpm update-data
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Contributing
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
pnpm install
|
|
247
|
+
pnpm test
|
|
248
|
+
pnpm build && node dist/cli/main.js examples
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`pnpm screenshot` regenerates `docs/screenshot.svg` from the real CLI output.
|
|
252
|
+
|
|
253
|
+
## License
|
|
254
|
+
|
|
255
|
+
MIT. Support data from [caniemail](https://github.com/hteumeuleu/caniemail) by Rémi Parmentier, MIT License, see [data/LICENSE-caniemail](data/LICENSE-caniemail).
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
<p align="center">
|
|
260
|
+
<a href="https://mscode.pl">
|
|
261
|
+
<picture>
|
|
262
|
+
<source media="(prefers-color-scheme: dark)" srcset=".github/mscode-logo-white.svg">
|
|
263
|
+
<img src=".github/mscode-logo-black.svg" alt="MSCode" height="28">
|
|
264
|
+
</picture>
|
|
265
|
+
</a>
|
|
266
|
+
</p>
|
|
267
|
+
|
|
268
|
+
<p align="center">
|
|
269
|
+
Built and maintained by <a href="https://mscode.pl">MSCode</a>, a Polish software house that makes websites and web and mobile apps.
|
|
270
|
+
</p>
|
|
271
|
+
|
|
272
|
+
<p align="center">
|
|
273
|
+
<a href="https://mscode.pl">mscode.pl</a> · <a href="https://github.com/mscode-pl">More packages</a> · <a href="https://github.com/mscode-pl/email-lint/issues">Report an issue</a>
|
|
274
|
+
</p>
|
package/data/LICENSE-caniemail
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Rémi Parmentier
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Rémi Parmentier
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/cli/main.js
CHANGED
|
@@ -10,33 +10,33 @@ import { CONFIG_FILE, FAIL_ON, loadConfig } from './config.js';
|
|
|
10
10
|
import { resolveFiles } from './files.js';
|
|
11
11
|
import { FORMATS, formatFromPath, onlyErrors, render } from './format.js';
|
|
12
12
|
import { runInteractive } from './interactive.js';
|
|
13
|
-
const HELP = `Usage: email-lint [files, folders or globs...] [options]
|
|
14
|
-
email-lint mcp Start an MCP server on stdio for AI agents
|
|
15
|
-
|
|
16
|
-
Checks email HTML against caniemail.com support data.
|
|
17
|
-
Run without arguments in a terminal for an interactive mode.
|
|
18
|
-
|
|
19
|
-
Options:
|
|
20
|
-
-c, --clients <list> Clients to check, e.g. gmail,outlook.windows or all
|
|
21
|
-
(default: ${DEFAULT_CLIENTS.join(',')})
|
|
22
|
-
-i, --ignore <list> Feature slugs to skip, e.g. css-display-flex
|
|
23
|
-
--strict Also report baseline features (doctype, <body>, <style>,
|
|
24
|
-
class selectors) and Gmail in a mobile browser
|
|
25
|
-
-f, --format <type> ${FORMATS.join(', ')} (default: text)
|
|
26
|
-
-o, --output <file> Also save the report; format follows the extension
|
|
27
|
-
(.json, .md, anything else is plain text)
|
|
28
|
-
--verbose Show caniemail notes and links for every issue
|
|
29
|
-
-q, --quiet Report errors only
|
|
30
|
-
--fail-on <level> ${FAIL_ON.join(', ')} (default: error)
|
|
31
|
-
--config <file> Config file (default: ${CONFIG_FILE} if present)
|
|
32
|
-
--stdin Read HTML from stdin
|
|
33
|
-
-v, --version Print version and data date
|
|
34
|
-
-h, --help Show this help
|
|
35
|
-
|
|
36
|
-
Examples:
|
|
37
|
-
email-lint dist/emails
|
|
38
|
-
email-lint "resources/views/emails/**/*.html" --clients gmail,outlook
|
|
39
|
-
email-lint emails -o email-report.md
|
|
13
|
+
const HELP = `Usage: email-lint [files, folders or globs...] [options]
|
|
14
|
+
email-lint mcp Start an MCP server on stdio for AI agents
|
|
15
|
+
|
|
16
|
+
Checks email HTML against caniemail.com support data.
|
|
17
|
+
Run without arguments in a terminal for an interactive mode.
|
|
18
|
+
|
|
19
|
+
Options:
|
|
20
|
+
-c, --clients <list> Clients to check, e.g. gmail,outlook.windows or all
|
|
21
|
+
(default: ${DEFAULT_CLIENTS.join(',')})
|
|
22
|
+
-i, --ignore <list> Feature slugs to skip, e.g. css-display-flex
|
|
23
|
+
--strict Also report baseline features (doctype, <body>, <style>,
|
|
24
|
+
class selectors) and Gmail in a mobile browser
|
|
25
|
+
-f, --format <type> ${FORMATS.join(', ')} (default: text)
|
|
26
|
+
-o, --output <file> Also save the report; format follows the extension
|
|
27
|
+
(.json, .md, anything else is plain text)
|
|
28
|
+
--verbose Show caniemail notes and links for every issue
|
|
29
|
+
-q, --quiet Report errors only
|
|
30
|
+
--fail-on <level> ${FAIL_ON.join(', ')} (default: error)
|
|
31
|
+
--config <file> Config file (default: ${CONFIG_FILE} if present)
|
|
32
|
+
--stdin Read HTML from stdin
|
|
33
|
+
-v, --version Print version and data date
|
|
34
|
+
-h, --help Show this help
|
|
35
|
+
|
|
36
|
+
Examples:
|
|
37
|
+
email-lint dist/emails
|
|
38
|
+
email-lint "resources/views/emails/**/*.html" --clients gmail,outlook
|
|
39
|
+
email-lint emails -o email-report.md
|
|
40
40
|
cat email.html | email-lint --stdin --format json`;
|
|
41
41
|
const list = (value) => value?.split(',').map((s) => s.trim()).filter(Boolean);
|
|
42
42
|
async function readStdin() {
|
package/package.json
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@mscode-pl/email-lint",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Find the CSS and HTML in your emails that Outlook, Gmail, Apple Mail and other clients will break, with line numbers. Ships an MCP server and a GitHub Action. Works with React Email, MJML, Maizzle, Laravel and plain HTML.",
|
|
5
|
-
"mcpName": "io.github.mscode-pl/email-lint",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"author": "MSCode (https://mscode.pl)",
|
|
8
|
-
"type": "module",
|
|
9
|
-
"homepage": "https://github.com/mscode-pl/email-lint#readme",
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/mscode-pl/email-lint.git"
|
|
13
|
-
},
|
|
14
|
-
"bugs": "https://github.com/mscode-pl/email-lint/issues",
|
|
15
|
-
"keywords": [
|
|
16
|
-
"email",
|
|
17
|
-
"html-email",
|
|
18
|
-
"lint",
|
|
19
|
-
"linter",
|
|
20
|
-
"caniemail",
|
|
21
|
-
"outlook",
|
|
22
|
-
"gmail",
|
|
23
|
-
"react-email",
|
|
24
|
-
"mjml",
|
|
25
|
-
"maizzle",
|
|
26
|
-
"cli",
|
|
27
|
-
"mcp",
|
|
28
|
-
"mcp-server",
|
|
29
|
-
"github-action"
|
|
30
|
-
],
|
|
31
|
-
"bin": {
|
|
32
|
-
"email-lint": "dist/cli/main.js"
|
|
33
|
-
},
|
|
34
|
-
"exports": {
|
|
35
|
-
".": {
|
|
36
|
-
"types": "./dist/index.d.ts",
|
|
37
|
-
"default": "./dist/index.js"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"files": [
|
|
41
|
-
"dist",
|
|
42
|
-
"data",
|
|
43
|
-
"skills"
|
|
44
|
-
],
|
|
45
|
-
"engines": {
|
|
46
|
-
"node": ">=22"
|
|
47
|
-
},
|
|
48
|
-
"packageManager": "pnpm@12.14.0",
|
|
49
|
-
"publishConfig": {
|
|
50
|
-
"access": "public"
|
|
51
|
-
},
|
|
52
|
-
"scripts": {
|
|
53
|
-
"build": "tsc -p tsconfig.build.json",
|
|
54
|
-
"typecheck": "tsc --noEmit",
|
|
55
|
-
"test": "vitest run",
|
|
56
|
-
"update-data": "node scripts/update-data.mjs",
|
|
57
|
-
"screenshot": "pnpm build && node scripts/render-screenshot.mjs",
|
|
58
|
-
"prepublishOnly": "pnpm typecheck && pnpm test && pnpm build"
|
|
59
|
-
},
|
|
60
|
-
"dependencies": {
|
|
61
|
-
"@clack/prompts": "^1.9.0",
|
|
62
|
-
"domhandler": "^6.0.1",
|
|
63
|
-
"htmlparser2": "^12.0.0",
|
|
64
|
-
"postcss": "^8.5.33"
|
|
65
|
-
},
|
|
66
|
-
"devDependencies": {
|
|
67
|
-
"@types/node": "^24.19.4",
|
|
68
|
-
"typescript": "^5.9.3",
|
|
69
|
-
"vitest": "^5.1.2"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@mscode-pl/email-lint",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "Find the CSS and HTML in your emails that Outlook, Gmail, Apple Mail and other clients will break, with line numbers. Ships an MCP server and a GitHub Action. Works with React Email, MJML, Maizzle, Laravel and plain HTML.",
|
|
5
|
+
"mcpName": "io.github.mscode-pl/email-lint",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "MSCode (https://mscode.pl)",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"homepage": "https://github.com/mscode-pl/email-lint#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/mscode-pl/email-lint.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": "https://github.com/mscode-pl/email-lint/issues",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"email",
|
|
17
|
+
"html-email",
|
|
18
|
+
"lint",
|
|
19
|
+
"linter",
|
|
20
|
+
"caniemail",
|
|
21
|
+
"outlook",
|
|
22
|
+
"gmail",
|
|
23
|
+
"react-email",
|
|
24
|
+
"mjml",
|
|
25
|
+
"maizzle",
|
|
26
|
+
"cli",
|
|
27
|
+
"mcp",
|
|
28
|
+
"mcp-server",
|
|
29
|
+
"github-action"
|
|
30
|
+
],
|
|
31
|
+
"bin": {
|
|
32
|
+
"email-lint": "dist/cli/main.js"
|
|
33
|
+
},
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"data",
|
|
43
|
+
"skills"
|
|
44
|
+
],
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=22"
|
|
47
|
+
},
|
|
48
|
+
"packageManager": "pnpm@12.14.0",
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc -p tsconfig.build.json",
|
|
54
|
+
"typecheck": "tsc --noEmit",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"update-data": "node scripts/update-data.mjs",
|
|
57
|
+
"screenshot": "pnpm build && node scripts/render-screenshot.mjs",
|
|
58
|
+
"prepublishOnly": "pnpm typecheck && pnpm test && pnpm build"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@clack/prompts": "^1.9.0",
|
|
62
|
+
"domhandler": "^6.0.1",
|
|
63
|
+
"htmlparser2": "^12.0.0",
|
|
64
|
+
"postcss": "^8.5.33"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@types/node": "^24.19.4",
|
|
68
|
+
"typescript": "^5.9.3",
|
|
69
|
+
"vitest": "^5.1.2"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: email-lint
|
|
3
|
-
description: Review HTML email templates for email client compatibility with email-lint and the caniemail.com dataset, then propose concrete fixes. Use when the user asks whether an email will render in Outlook, Gmail, Apple Mail or Yahoo, wants an email template reviewed or audited, or is building emails with React Email, MJML, Maizzle, Laravel Blade or plain HTML.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# email-lint review
|
|
7
|
-
|
|
8
|
-
email-lint reports which CSS and HTML features in an email are unsupported or only partly supported in each email client, with line numbers. Your job is to run it, decide which findings matter, and propose fixes in the template source.
|
|
9
|
-
|
|
10
|
-
## 1. Get HTML to lint
|
|
11
|
-
|
|
12
|
-
email-lint reads rendered HTML. Find the templates and render them if needed:
|
|
13
|
-
|
|
14
|
-
| Stack | How to get HTML |
|
|
15
|
-
| --- | --- |
|
|
16
|
-
| Plain HTML | Lint the files directly |
|
|
17
|
-
| React Email | `npx email export --outDir .email-lint-out`, then lint `.email-lint-out` |
|
|
18
|
-
| MJML | `npx mjml "emails/**/*.mjml" -o .email-lint-out/`, then lint `.email-lint-out` |
|
|
19
|
-
| Maizzle | `npx maizzle build production`, then lint the output folder from `config.production.js` |
|
|
20
|
-
| laravel-react-email | `php artisan react-email:build`, then lint `"resources/views/react-email/**/*.blade.php"` |
|
|
21
|
-
| Other Laravel mailables | Render with `(new App\Mail\Welcome(...))->render()` in `php artisan tinker`, save to a `.html` file |
|
|
22
|
-
|
|
23
|
-
Blade syntax (`{{ }}`, `@if`) is read as text and does not cause false reports. Delete any output folder you created once the review is done.
|
|
24
|
-
|
|
25
|
-
## 2. Run the linter
|
|
26
|
-
|
|
27
|
-
If the `lint_email` and `explain_feature` tools from the email-lint MCP server are available, use them instead of the command below: `lint_email` takes the same `clients`, `ignore` and `strict` options plus `html` or `path`, and `explain_feature` returns the fix for one slug.
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npx -y @mscode-pl/email-lint <files, folders or globs> --format json
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
- If the user named their audience ("our customers use Outlook at work"), pass `--clients`, e.g. `--clients outlook,gmail`. Valid values: a family (`gmail`, `outlook`, `apple-mail`, `yahoo`, `samsung-email`, `thunderbird`, `protonmail`, `wp-pl`, ...), a family and platform (`outlook.windows`), or `all`.
|
|
34
|
-
- Without `--strict`, features every email needs (doctype, `<body>`, `<style>`, tables, class selectors, generic `@media`, `role`/`aria-*`) and Gmail in a mobile browser are skipped. Leave it that way unless the user asks for a full audit.
|
|
35
|
-
- Exit code 1 means errors were found, which is expected during a review. Exit code 2 means bad arguments or no files matched.
|
|
36
|
-
|
|
37
|
-
The JSON is an array with one entry per file:
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
{ file, errors, warnings, parseErrors: [{ line, message }],
|
|
41
|
-
issues: [{ slug, title, url, level, lines,
|
|
42
|
-
clients: [{ family, platform, familyName, platformName, status, notes }] }] }
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
`level` is `error` when at least one selected client does not support the feature, `warning` when support is partial. Always read `notes`: they often say the real limitation (for example "not supported with non Google accounts" or "only on `<td>`").
|
|
46
|
-
|
|
47
|
-
## 3. Triage
|
|
48
|
-
|
|
49
|
-
Open [references/fixes.md](references/fixes.md) and sort every issue into one of two groups:
|
|
50
|
-
|
|
51
|
-
- **Must fix**: the email breaks or loses content in a client the user cares about (layout collapses, images do not show, text is unreadable).
|
|
52
|
-
- **Acceptable degradation**: the client drops a visual extra and the email still works (rounded corners, shadows, hover effects, animation, dark mode tweaks). Name it, but do not push the user to remove it.
|
|
53
|
-
|
|
54
|
-
An issue is only worth raising if it affects a client the user's audience uses. Outlook for Windows matters for B2B senders, much less for a consumer newsletter.
|
|
55
|
-
|
|
56
|
-
## 4. Report
|
|
57
|
-
|
|
58
|
-
Per template, list must-fix issues first, then acceptable degradation, then parse errors. For each issue give:
|
|
59
|
-
|
|
60
|
-
- the feature and where it is used (source file and line, not only the built file)
|
|
61
|
-
- which clients are affected, grouped by family
|
|
62
|
-
- the fix from `references/fixes.md`, adapted to the user's stack (a React Email component, an MJML tag, a Tailwind class)
|
|
63
|
-
|
|
64
|
-
Keep it short. Do not repeat the caniemail notes word for word when one sentence covers them; link the `url` for details.
|
|
65
|
-
|
|
66
|
-
## 5. Fixing
|
|
67
|
-
|
|
68
|
-
Edit only when the user asks. Fix the source template (`.tsx`, `.mjml`, `.blade.php`), never the generated HTML, then rebuild and run email-lint again to confirm the issue is gone. If a fix needs VML or MSO conditional comments, say that it can only be verified by rendering in Outlook for Windows (Litmus, Email on Acid, or a real client).
|
|
1
|
+
---
|
|
2
|
+
name: email-lint
|
|
3
|
+
description: Review HTML email templates for email client compatibility with email-lint and the caniemail.com dataset, then propose concrete fixes. Use when the user asks whether an email will render in Outlook, Gmail, Apple Mail or Yahoo, wants an email template reviewed or audited, or is building emails with React Email, MJML, Maizzle, Laravel Blade or plain HTML.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# email-lint review
|
|
7
|
+
|
|
8
|
+
email-lint reports which CSS and HTML features in an email are unsupported or only partly supported in each email client, with line numbers. Your job is to run it, decide which findings matter, and propose fixes in the template source.
|
|
9
|
+
|
|
10
|
+
## 1. Get HTML to lint
|
|
11
|
+
|
|
12
|
+
email-lint reads rendered HTML. Find the templates and render them if needed:
|
|
13
|
+
|
|
14
|
+
| Stack | How to get HTML |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| Plain HTML | Lint the files directly |
|
|
17
|
+
| React Email | `npx email export --outDir .email-lint-out`, then lint `.email-lint-out` |
|
|
18
|
+
| MJML | `npx mjml "emails/**/*.mjml" -o .email-lint-out/`, then lint `.email-lint-out` |
|
|
19
|
+
| Maizzle | `npx maizzle build production`, then lint the output folder from `config.production.js` |
|
|
20
|
+
| laravel-react-email | `php artisan react-email:build`, then lint `"resources/views/react-email/**/*.blade.php"` |
|
|
21
|
+
| Other Laravel mailables | Render with `(new App\Mail\Welcome(...))->render()` in `php artisan tinker`, save to a `.html` file |
|
|
22
|
+
|
|
23
|
+
Blade syntax (`{{ }}`, `@if`) is read as text and does not cause false reports. Delete any output folder you created once the review is done.
|
|
24
|
+
|
|
25
|
+
## 2. Run the linter
|
|
26
|
+
|
|
27
|
+
If the `lint_email` and `explain_feature` tools from the email-lint MCP server are available, use them instead of the command below: `lint_email` takes the same `clients`, `ignore` and `strict` options plus `html` or `path`, and `explain_feature` returns the fix for one slug.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx -y @mscode-pl/email-lint <files, folders or globs> --format json
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- If the user named their audience ("our customers use Outlook at work"), pass `--clients`, e.g. `--clients outlook,gmail`. Valid values: a family (`gmail`, `outlook`, `apple-mail`, `yahoo`, `samsung-email`, `thunderbird`, `protonmail`, `wp-pl`, ...), a family and platform (`outlook.windows`), or `all`.
|
|
34
|
+
- Without `--strict`, features every email needs (doctype, `<body>`, `<style>`, tables, class selectors, generic `@media`, `role`/`aria-*`) and Gmail in a mobile browser are skipped. Leave it that way unless the user asks for a full audit.
|
|
35
|
+
- Exit code 1 means errors were found, which is expected during a review. Exit code 2 means bad arguments or no files matched.
|
|
36
|
+
|
|
37
|
+
The JSON is an array with one entry per file:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
{ file, errors, warnings, parseErrors: [{ line, message }],
|
|
41
|
+
issues: [{ slug, title, url, level, lines,
|
|
42
|
+
clients: [{ family, platform, familyName, platformName, status, notes }] }] }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`level` is `error` when at least one selected client does not support the feature, `warning` when support is partial. Always read `notes`: they often say the real limitation (for example "not supported with non Google accounts" or "only on `<td>`").
|
|
46
|
+
|
|
47
|
+
## 3. Triage
|
|
48
|
+
|
|
49
|
+
Open [references/fixes.md](references/fixes.md) and sort every issue into one of two groups:
|
|
50
|
+
|
|
51
|
+
- **Must fix**: the email breaks or loses content in a client the user cares about (layout collapses, images do not show, text is unreadable).
|
|
52
|
+
- **Acceptable degradation**: the client drops a visual extra and the email still works (rounded corners, shadows, hover effects, animation, dark mode tweaks). Name it, but do not push the user to remove it.
|
|
53
|
+
|
|
54
|
+
An issue is only worth raising if it affects a client the user's audience uses. Outlook for Windows matters for B2B senders, much less for a consumer newsletter.
|
|
55
|
+
|
|
56
|
+
## 4. Report
|
|
57
|
+
|
|
58
|
+
Per template, list must-fix issues first, then acceptable degradation, then parse errors. For each issue give:
|
|
59
|
+
|
|
60
|
+
- the feature and where it is used (source file and line, not only the built file)
|
|
61
|
+
- which clients are affected, grouped by family
|
|
62
|
+
- the fix from `references/fixes.md`, adapted to the user's stack (a React Email component, an MJML tag, a Tailwind class)
|
|
63
|
+
|
|
64
|
+
Keep it short. Do not repeat the caniemail notes word for word when one sentence covers them; link the `url` for details.
|
|
65
|
+
|
|
66
|
+
## 5. Fixing
|
|
67
|
+
|
|
68
|
+
Edit only when the user asks. Fix the source template (`.tsx`, `.mjml`, `.blade.php`), never the generated HTML, then rebuild and run email-lint again to confirm the issue is gone. If a fix needs VML or MSO conditional comments, say that it can only be verified by rendering in Outlook for Windows (Litmus, Email on Acid, or a real client).
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
# Fixes by feature
|
|
2
|
-
|
|
3
|
-
Keyed by the `slug` email-lint reports. "Outlook" without a platform means Outlook for Windows (Word rendering engine), the client behind most layout breakage.
|
|
4
|
-
|
|
5
|
-
## Must fix
|
|
6
|
-
|
|
7
|
-
### Layout
|
|
8
|
-
|
|
9
|
-
| Slug | Fix |
|
|
10
|
-
| --- | --- |
|
|
11
|
-
| `css-display-flex`, `css-display-grid`, `css-flex-direction`, `css-flex-wrap`, `css-gap`, `css-grid-template` | Build the layout with `<table role="presentation">` and `<td>` columns. Replace `gap` with padding on the cells or an empty spacer `<td>`. For columns that stack on mobile, use inline-block `<div>`s wrapped in an MSO conditional table (the "hybrid" or "fluid" pattern). |
|
|
12
|
-
| `css-max-width` | Outlook ignores it on `<div>`. Keep the `max-width` and add a fixed-width ghost table around the content: `<!--[if mso]><table role="presentation" width="600"><tr><td><![endif]-->` ... `<!--[if mso]></td></tr></table><![endif]-->`. |
|
|
13
|
-
| `css-margin`, `css-padding` | Outlook applies them unreliably on `<div>` and `<p>`. Put spacing as `padding` on a `<td>`. |
|
|
14
|
-
| `css-width`, `css-height` | Partial in Outlook on `<div>`, `<p>` and `<img>`. Set sizes with the `width`/`height` HTML attributes on `<img>` and `<td>`, keep CSS for other clients. |
|
|
15
|
-
| `css-float` | Use table cells, or the `align` attribute on `<table>`/`<img>`. |
|
|
16
|
-
| `css-position`, `css-left-right-top-bottom`, `css-inset` | No reliable support. Rebuild the overlap with tables, or bake it into an image. |
|
|
17
|
-
| `css-unit-calc` | Replace with a fixed `px` or `%` value. |
|
|
18
|
-
| `css-unit-rem`, `css-unit-vw`, `css-unit-vh` | Convert to `px`. With Tailwind, use a theme whose spacing and font sizes are in `px`. |
|
|
19
|
-
| `css-variables` | Inline the resolved values. Most email builders and Tailwind configs can do this at build time. |
|
|
20
|
-
|
|
21
|
-
### Images and media
|
|
22
|
-
|
|
23
|
-
| Slug | Fix |
|
|
24
|
-
| --- | --- |
|
|
25
|
-
| `image-webp`, `image-avif`, `image-heif` | Serve PNG or JPG. |
|
|
26
|
-
| `image-svg`, `html-svg` | Export to PNG at 2x resolution and set the display size with the `width` attribute. |
|
|
27
|
-
| `image-base64` | Host the image and link it by URL. Several clients block or strip data URIs. |
|
|
28
|
-
| `css-background-image` | Always set a `background-color` fallback. For Outlook, add a VML `<v:rect>` with `<v:fill type="frame">` in an MSO conditional (generator: backgrounds.cm). |
|
|
29
|
-
| `css-linear-gradient`, `css-radial-gradient` | Put a solid `background-color` before the gradient so clients without support still get a readable background. |
|
|
30
|
-
| `css-object-fit`, `css-object-position` | Crop the image to the exact size before sending. |
|
|
31
|
-
| `html-picture`, `html-srcset` | Keep a plain `<img src>` (inside `<picture>` it is the fallback) pointing at a PNG or JPG. |
|
|
32
|
-
| `html-video`, `html-audio` | Use a static image or an animated GIF linked to the hosted video. |
|
|
33
|
-
|
|
34
|
-
### Forms and fonts
|
|
35
|
-
|
|
36
|
-
| Slug | Fix |
|
|
37
|
-
| --- | --- |
|
|
38
|
-
| `html-form`, `html-input-*`, `html-select`, `html-textarea`, `html-button-*` | Link to a hosted form instead. Interactive form controls fail or are disabled in most clients. |
|
|
39
|
-
| `css-at-font-face`, `css-at-import` | Always end `font-family` with a safe stack (`Arial, Helvetica, sans-serif`). Outlook falls back to Times New Roman otherwise; force the fallback with `<!--[if mso]><style>body, table, td { font-family: Arial, sans-serif !important; }</style><![endif]-->`. |
|
|
40
|
-
|
|
41
|
-
## Acceptable degradation
|
|
42
|
-
|
|
43
|
-
These drop a visual extra. The email keeps working, so report them as information, and check only that the design still reads well without them.
|
|
44
|
-
|
|
45
|
-
| Slug | Without support |
|
|
46
|
-
| --- | --- |
|
|
47
|
-
| `css-border-radius` | Square corners. For a rounded button in Outlook, use a VML `<v:roundrect>` (generator: buttons.cm). |
|
|
48
|
-
| `css-box-shadow`, `css-text-shadow`, `css-opacity`, `css-filter`, `css-transform`, `css-mix-blend-mode`, `css-backdrop-filter` | The effect is not shown. Make sure no text relies on it for contrast. |
|
|
49
|
-
| `css-pseudo-class-hover`, `css-transition`, `css-animation`, `css-at-keyframes` | No hover state or motion. The static state must be complete on its own. |
|
|
50
|
-
| `css-at-media-prefers-color-scheme` | No custom dark mode. Gmail and Outlook may still invert colors themselves, so check that logos and text stay readable on both light and dark backgrounds (transparent PNG logos with a light outline help). |
|
|
51
|
-
| `css-at-media-hover`, `css-at-media-orientation`, `css-at-media-prefers-reduced-motion` | The media query is ignored and base styles apply. |
|
|
52
|
-
| `html-meta-color-scheme` | The client decides the color scheme. |
|
|
53
|
-
| `css-text-decoration`, `css-text-decoration-*`, `css-text-underline-offset` | Plain underline or none. Do not rely on custom underline styles to mark links. |
|
|
54
|
-
| `html-mailto-links` | Some query parameters (often `bcc`) are dropped. Keep the address itself complete. |
|
|
55
|
-
|
|
56
|
-
## Anything not listed
|
|
57
|
-
|
|
58
|
-
Read the issue `notes` and the caniemail page at `url`. Ask: does the email lose content or become unusable in that client? If yes, it is a must fix; propose the closest table-based or attribute-based alternative. If only decoration is lost, it is acceptable degradation.
|
|
1
|
+
# Fixes by feature
|
|
2
|
+
|
|
3
|
+
Keyed by the `slug` email-lint reports. "Outlook" without a platform means Outlook for Windows (Word rendering engine), the client behind most layout breakage.
|
|
4
|
+
|
|
5
|
+
## Must fix
|
|
6
|
+
|
|
7
|
+
### Layout
|
|
8
|
+
|
|
9
|
+
| Slug | Fix |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `css-display-flex`, `css-display-grid`, `css-flex-direction`, `css-flex-wrap`, `css-gap`, `css-grid-template` | Build the layout with `<table role="presentation">` and `<td>` columns. Replace `gap` with padding on the cells or an empty spacer `<td>`. For columns that stack on mobile, use inline-block `<div>`s wrapped in an MSO conditional table (the "hybrid" or "fluid" pattern). |
|
|
12
|
+
| `css-max-width` | Outlook ignores it on `<div>`. Keep the `max-width` and add a fixed-width ghost table around the content: `<!--[if mso]><table role="presentation" width="600"><tr><td><![endif]-->` ... `<!--[if mso]></td></tr></table><![endif]-->`. |
|
|
13
|
+
| `css-margin`, `css-padding` | Outlook applies them unreliably on `<div>` and `<p>`. Put spacing as `padding` on a `<td>`. |
|
|
14
|
+
| `css-width`, `css-height` | Partial in Outlook on `<div>`, `<p>` and `<img>`. Set sizes with the `width`/`height` HTML attributes on `<img>` and `<td>`, keep CSS for other clients. |
|
|
15
|
+
| `css-float` | Use table cells, or the `align` attribute on `<table>`/`<img>`. |
|
|
16
|
+
| `css-position`, `css-left-right-top-bottom`, `css-inset` | No reliable support. Rebuild the overlap with tables, or bake it into an image. |
|
|
17
|
+
| `css-unit-calc` | Replace with a fixed `px` or `%` value. |
|
|
18
|
+
| `css-unit-rem`, `css-unit-vw`, `css-unit-vh` | Convert to `px`. With Tailwind, use a theme whose spacing and font sizes are in `px`. |
|
|
19
|
+
| `css-variables` | Inline the resolved values. Most email builders and Tailwind configs can do this at build time. |
|
|
20
|
+
|
|
21
|
+
### Images and media
|
|
22
|
+
|
|
23
|
+
| Slug | Fix |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| `image-webp`, `image-avif`, `image-heif` | Serve PNG or JPG. |
|
|
26
|
+
| `image-svg`, `html-svg` | Export to PNG at 2x resolution and set the display size with the `width` attribute. |
|
|
27
|
+
| `image-base64` | Host the image and link it by URL. Several clients block or strip data URIs. |
|
|
28
|
+
| `css-background-image` | Always set a `background-color` fallback. For Outlook, add a VML `<v:rect>` with `<v:fill type="frame">` in an MSO conditional (generator: backgrounds.cm). |
|
|
29
|
+
| `css-linear-gradient`, `css-radial-gradient` | Put a solid `background-color` before the gradient so clients without support still get a readable background. |
|
|
30
|
+
| `css-object-fit`, `css-object-position` | Crop the image to the exact size before sending. |
|
|
31
|
+
| `html-picture`, `html-srcset` | Keep a plain `<img src>` (inside `<picture>` it is the fallback) pointing at a PNG or JPG. |
|
|
32
|
+
| `html-video`, `html-audio` | Use a static image or an animated GIF linked to the hosted video. |
|
|
33
|
+
|
|
34
|
+
### Forms and fonts
|
|
35
|
+
|
|
36
|
+
| Slug | Fix |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `html-form`, `html-input-*`, `html-select`, `html-textarea`, `html-button-*` | Link to a hosted form instead. Interactive form controls fail or are disabled in most clients. |
|
|
39
|
+
| `css-at-font-face`, `css-at-import` | Always end `font-family` with a safe stack (`Arial, Helvetica, sans-serif`). Outlook falls back to Times New Roman otherwise; force the fallback with `<!--[if mso]><style>body, table, td { font-family: Arial, sans-serif !important; }</style><![endif]-->`. |
|
|
40
|
+
|
|
41
|
+
## Acceptable degradation
|
|
42
|
+
|
|
43
|
+
These drop a visual extra. The email keeps working, so report them as information, and check only that the design still reads well without them.
|
|
44
|
+
|
|
45
|
+
| Slug | Without support |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `css-border-radius` | Square corners. For a rounded button in Outlook, use a VML `<v:roundrect>` (generator: buttons.cm). |
|
|
48
|
+
| `css-box-shadow`, `css-text-shadow`, `css-opacity`, `css-filter`, `css-transform`, `css-mix-blend-mode`, `css-backdrop-filter` | The effect is not shown. Make sure no text relies on it for contrast. |
|
|
49
|
+
| `css-pseudo-class-hover`, `css-transition`, `css-animation`, `css-at-keyframes` | No hover state or motion. The static state must be complete on its own. |
|
|
50
|
+
| `css-at-media-prefers-color-scheme` | No custom dark mode. Gmail and Outlook may still invert colors themselves, so check that logos and text stay readable on both light and dark backgrounds (transparent PNG logos with a light outline help). |
|
|
51
|
+
| `css-at-media-hover`, `css-at-media-orientation`, `css-at-media-prefers-reduced-motion` | The media query is ignored and base styles apply. |
|
|
52
|
+
| `html-meta-color-scheme` | The client decides the color scheme. |
|
|
53
|
+
| `css-text-decoration`, `css-text-decoration-*`, `css-text-underline-offset` | Plain underline or none. Do not rely on custom underline styles to mark links. |
|
|
54
|
+
| `html-mailto-links` | Some query parameters (often `bcc`) are dropped. Keep the address itself complete. |
|
|
55
|
+
|
|
56
|
+
## Anything not listed
|
|
57
|
+
|
|
58
|
+
Read the issue `notes` and the caniemail page at `url`. Ask: does the email lose content or become unusable in that client? If yes, it is a must fix; propose the closest table-based or attribute-based alternative. If only decoration is lost, it is acceptable degradation.
|