@mscode-pl/email-lint 0.0.0-stage → 0.2.0
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 -0
- package/README.md +274 -3
- package/data/LICENSE-caniemail +21 -0
- package/data/caniemail.json +1 -0
- package/dist/cli/colors.d.ts +13 -0
- package/dist/cli/colors.js +23 -0
- package/dist/cli/config.d.ts +11 -0
- package/dist/cli/config.js +56 -0
- package/dist/cli/files.d.ts +7 -0
- package/dist/cli/files.js +44 -0
- package/dist/cli/format.d.ts +23 -0
- package/dist/cli/format.js +204 -0
- package/dist/cli/interactive.d.ts +1 -0
- package/dist/cli/interactive.js +154 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +142 -0
- package/dist/core/baseline.d.ts +1 -0
- package/dist/core/baseline.js +24 -0
- package/dist/core/clients.d.ts +22 -0
- package/dist/core/clients.js +65 -0
- package/dist/core/data.d.ts +20 -0
- package/dist/core/data.js +6 -0
- package/dist/core/lint.d.ts +27 -0
- package/dist/core/lint.js +217 -0
- package/dist/core/rules.d.ts +23 -0
- package/dist/core/rules.js +164 -0
- package/dist/core/selectors.d.ts +15 -0
- package/dist/core/selectors.js +47 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +6 -0
- package/dist/mcp/fixes.d.ts +16 -0
- package/dist/mcp/fixes.js +48 -0
- package/dist/mcp/server.d.ts +19 -0
- package/dist/mcp/server.js +118 -0
- package/dist/mcp/tools.d.ts +83 -0
- package/dist/mcp/tools.js +161 -0
- package/package.json +70 -6
- package/skills/email-lint/SKILL.md +68 -0
- package/skills/email-lint/references/fixes.md +58 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { painter } from '../cli/colors.js';
|
|
3
|
+
import { loadConfig } from '../cli/config.js';
|
|
4
|
+
import { resolveFiles } from '../cli/files.js';
|
|
5
|
+
import { formatText, groupClients } from '../cli/format.js';
|
|
6
|
+
import { DEFAULT_CLIENTS, parseClients, unsupportedClients } from '../core/clients.js';
|
|
7
|
+
import { loadDataset } from '../core/data.js';
|
|
8
|
+
import { lint } from '../core/lint.js';
|
|
9
|
+
import { fallbackAdvice, findFix } from './fixes.js';
|
|
10
|
+
export class ToolInputError extends Error {
|
|
11
|
+
}
|
|
12
|
+
const CLIENTS_DESCRIPTION = 'Email clients to check: a family (gmail, outlook, apple-mail, yahoo, samsung-email, thunderbird, protonmail, wp-pl, ...), a family and platform (outlook.windows) or "all". Defaults to email-lint.config.json, then to ' +
|
|
13
|
+
`${DEFAULT_CLIENTS.join(', ')}. Pass only clients the audience of the email uses.`;
|
|
14
|
+
export const TOOLS = [
|
|
15
|
+
{
|
|
16
|
+
name: 'lint_email',
|
|
17
|
+
title: 'Lint email HTML',
|
|
18
|
+
description: 'Check email HTML against caniemail.com support data and list the CSS and HTML features that Outlook, Gmail, Apple Mail and other clients do not support, with line numbers, affected clients and caniemail notes. Pass rendered HTML (React Email, MJML and Maizzle must be built first; laravel-react-email Blade output and plain HTML can be linted directly). With neither html nor path, lints the files from email-lint.config.json. Follow up with explain_feature for a fix.',
|
|
19
|
+
inputSchema: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
html: { type: 'string', description: 'Email HTML to check. Use this or path.' },
|
|
23
|
+
path: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'File, folder or glob relative to the working directory, e.g. "emails/out" or "resources/views/react-email/**/*.blade.php". Folders are searched for .html and .htm files. Use this or html.',
|
|
26
|
+
},
|
|
27
|
+
clients: { type: 'array', items: { type: 'string' }, description: CLIENTS_DESCRIPTION },
|
|
28
|
+
ignore: {
|
|
29
|
+
type: 'array',
|
|
30
|
+
items: { type: 'string' },
|
|
31
|
+
description: 'Feature slugs to skip, e.g. ["css-border-radius"].',
|
|
32
|
+
},
|
|
33
|
+
strict: {
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
description: 'Also report baseline features every email needs (doctype, <style>, class selectors) and Gmail in a mobile browser. Leave off unless a full audit is asked for.',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
},
|
|
40
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'explain_feature',
|
|
44
|
+
title: 'Explain an email feature',
|
|
45
|
+
description: 'Explain one feature reported by lint_email: which clients lack support, the caniemail notes, whether it breaks the email (must fix) or only drops decoration (acceptable degradation), and how to fix it.',
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
slug: { type: 'string', description: 'Feature slug from lint_email, e.g. "css-display-flex".' },
|
|
50
|
+
clients: { type: 'array', items: { type: 'string' }, description: CLIENTS_DESCRIPTION },
|
|
51
|
+
},
|
|
52
|
+
required: ['slug'],
|
|
53
|
+
additionalProperties: false,
|
|
54
|
+
},
|
|
55
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
const text = (value, extra = {}) => ({
|
|
59
|
+
content: [{ type: 'text', text: value }],
|
|
60
|
+
...extra,
|
|
61
|
+
});
|
|
62
|
+
function optionalString(args, key) {
|
|
63
|
+
const value = args[key];
|
|
64
|
+
if (value === undefined)
|
|
65
|
+
return undefined;
|
|
66
|
+
if (typeof value !== 'string' || !value.trim())
|
|
67
|
+
throw new ToolInputError(`"${key}" must be a non-empty string.`);
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
function optionalList(args, key) {
|
|
71
|
+
const value = args[key];
|
|
72
|
+
if (value === undefined)
|
|
73
|
+
return undefined;
|
|
74
|
+
if (!Array.isArray(value) || value.some((v) => typeof v !== 'string')) {
|
|
75
|
+
throw new ToolInputError(`"${key}" must be an array of strings.`);
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
async function lintEmail(args) {
|
|
80
|
+
const html = optionalString(args, 'html');
|
|
81
|
+
const path = optionalString(args, 'path');
|
|
82
|
+
if (html && path)
|
|
83
|
+
throw new ToolInputError('Pass either "html" or "path", not both.');
|
|
84
|
+
if (args.strict !== undefined && typeof args.strict !== 'boolean') {
|
|
85
|
+
throw new ToolInputError('"strict" must be true or false.');
|
|
86
|
+
}
|
|
87
|
+
const config = await loadConfig();
|
|
88
|
+
const options = {
|
|
89
|
+
clients: optionalList(args, 'clients') ?? config.clients,
|
|
90
|
+
ignore: optionalList(args, 'ignore') ?? config.ignore,
|
|
91
|
+
strict: args.strict ?? config.strict,
|
|
92
|
+
};
|
|
93
|
+
const results = [];
|
|
94
|
+
if (html) {
|
|
95
|
+
results.push({ file: '<html>', ...lint(html, options) });
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const patterns = path ? [path] : (config.files ?? []);
|
|
99
|
+
if (!patterns.length) {
|
|
100
|
+
throw new ToolInputError('Pass "html" or "path". There is no email-lint.config.json with "files" to fall back on.');
|
|
101
|
+
}
|
|
102
|
+
const files = await resolveFiles(patterns);
|
|
103
|
+
if (!files.length) {
|
|
104
|
+
throw new ToolInputError(`No HTML files found for ${patterns.join(' ')} in ${process.cwd()}.`);
|
|
105
|
+
}
|
|
106
|
+
for (const file of files)
|
|
107
|
+
results.push({ file, ...lint(await readFile(file, 'utf8'), options) });
|
|
108
|
+
}
|
|
109
|
+
return text(formatText(results, { verbose: true, paint: painter(false) }));
|
|
110
|
+
}
|
|
111
|
+
async function explainFeature(args) {
|
|
112
|
+
const slug = optionalString(args, 'slug');
|
|
113
|
+
if (!slug)
|
|
114
|
+
throw new ToolInputError('"slug" is required.');
|
|
115
|
+
const dataset = loadDataset();
|
|
116
|
+
const feature = dataset.data.find((f) => f.slug === slug);
|
|
117
|
+
if (!feature) {
|
|
118
|
+
const words = slug.split('-').filter((w) => w.length > 2 && !['css', 'html'].includes(w));
|
|
119
|
+
const similar = dataset.data
|
|
120
|
+
.filter((f) => words.some((w) => f.slug.includes(w)))
|
|
121
|
+
.slice(0, 8)
|
|
122
|
+
.map((f) => f.slug);
|
|
123
|
+
throw new ToolInputError(`Unknown feature "${slug}".${similar.length ? ` Similar: ${similar.join(', ')}.` : ''}`);
|
|
124
|
+
}
|
|
125
|
+
const config = await loadConfig();
|
|
126
|
+
const selection = parseClients(optionalList(args, 'clients') ?? config.clients, dataset, config.strict);
|
|
127
|
+
const clients = unsupportedClients(feature, dataset, selection);
|
|
128
|
+
const unsupported = groupClients(clients, 'unsupported');
|
|
129
|
+
const partial = groupClients(clients, 'partial');
|
|
130
|
+
const notes = [...new Set(clients.flatMap((c) => c.notes))];
|
|
131
|
+
const fix = findFix(slug);
|
|
132
|
+
const out = [`${feature.title.trim()} (${slug})`, feature.url, ''];
|
|
133
|
+
if (!clients.length)
|
|
134
|
+
out.push('Supported in every selected client.');
|
|
135
|
+
if (unsupported)
|
|
136
|
+
out.push(`Not supported: ${unsupported}`);
|
|
137
|
+
if (partial)
|
|
138
|
+
out.push(`Partial support: ${partial}`);
|
|
139
|
+
if (notes.length)
|
|
140
|
+
out.push('', 'Notes:', ...notes.map((n) => `- ${n}`));
|
|
141
|
+
out.push('');
|
|
142
|
+
if (fix?.kind === 'must-fix')
|
|
143
|
+
out.push('Must fix: the email breaks or loses content without support.', fix.text);
|
|
144
|
+
else if (fix)
|
|
145
|
+
out.push('Acceptable degradation: only decoration is lost without support.', fix.text);
|
|
146
|
+
else
|
|
147
|
+
out.push('No stock fix for this feature.', fallbackAdvice());
|
|
148
|
+
return text(out.join('\n'));
|
|
149
|
+
}
|
|
150
|
+
export async function callTool(name, args) {
|
|
151
|
+
try {
|
|
152
|
+
if (name === 'lint_email')
|
|
153
|
+
return await lintEmail(args);
|
|
154
|
+
if (name === 'explain_feature')
|
|
155
|
+
return await explainFeature(args);
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
return text(error instanceof Error ? error.message : String(error), { isError: true });
|
|
159
|
+
}
|
|
160
|
+
throw new ToolInputError(`Unknown tool "${name}".`);
|
|
161
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@mscode-pl/email-lint",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@mscode-pl/email-lint",
|
|
3
|
+
"version": "0.2.0",
|
|
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
|
+
"license": "MIT",
|
|
6
|
+
"author": "MSCode (https://mscode.pl)",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"homepage": "https://github.com/mscode-pl/email-lint#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/mscode-pl/email-lint.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": "https://github.com/mscode-pl/email-lint/issues",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"email",
|
|
16
|
+
"html-email",
|
|
17
|
+
"lint",
|
|
18
|
+
"linter",
|
|
19
|
+
"caniemail",
|
|
20
|
+
"outlook",
|
|
21
|
+
"gmail",
|
|
22
|
+
"react-email",
|
|
23
|
+
"mjml",
|
|
24
|
+
"maizzle",
|
|
25
|
+
"cli",
|
|
26
|
+
"mcp",
|
|
27
|
+
"mcp-server",
|
|
28
|
+
"github-action"
|
|
29
|
+
],
|
|
30
|
+
"bin": {
|
|
31
|
+
"email-lint": "dist/cli/main.js"
|
|
32
|
+
},
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"data",
|
|
42
|
+
"skills"
|
|
43
|
+
],
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=22"
|
|
46
|
+
},
|
|
47
|
+
"packageManager": "pnpm@12.14.0",
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsc -p tsconfig.build.json",
|
|
53
|
+
"typecheck": "tsc --noEmit",
|
|
54
|
+
"test": "vitest run",
|
|
55
|
+
"update-data": "node scripts/update-data.mjs",
|
|
56
|
+
"screenshot": "pnpm build && node scripts/render-screenshot.mjs",
|
|
57
|
+
"prepublishOnly": "pnpm typecheck && pnpm test && pnpm build"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@clack/prompts": "^1.9.0",
|
|
61
|
+
"domhandler": "^6.0.1",
|
|
62
|
+
"htmlparser2": "^12.0.0",
|
|
63
|
+
"postcss": "^8.5.33"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@types/node": "^24.19.4",
|
|
67
|
+
"typescript": "^5.9.3",
|
|
68
|
+
"vitest": "^5.1.2"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +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).
|
|
@@ -0,0 +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.
|