Skip to main content

Our email CSS engine is open source. Give it a star on GitHub 

Emailens
Blog

How to Test an HTML Email Before You Send (Checklist)

Check the compiled HTML for client support, size and accessibility, preview it at phone and desktop widths in light and dark, confirm it in real Outlook, Gmail and Apple Mail, check the sending setup, and run the same checks in CI.

The checker needs a computer screen.

A free account opens all 21 clients and keeps your checks for 7 days. Create a free account →

Philippe Kam, founder of Emailens · Published 6 Oct 2026 · Updated 28 Oct 2026

@emailens/engine 0.19.3 · data last changed 10 Nov 2026

Part of the HTML email guide · all guides

You send a test to your own Gmail, it looks fine, and the campaign goes out. Then the replies arrive: Outlook on Windows spread the two columns across the screen, Gmail on Android turned the logo into a smudge, and Gmail cut off the bottom of the email, unsubscribe link and all. This is how to catch those before they ship: a four-step workflow, a way to automate it, and the checklist to run before every send.

Why a test send to yourself isn't enough

  • Forwarding changes the email. When you forward a test to a colleague to see it in their Outlook, your webmail rewrites the markup, can drop the <style> block and wraps the content in quotes. They are looking at the forward.
  • Outlook for Mac is not Outlook for Windows. Outlook for Mac renders with WebKit and handles flexbox and rounded corners. Classic Outlook on Windows renders with Microsoft Word and does neither.
  • Display scaling hides bugs. At 100% scaling table borders line up. At 125% (120 DPI) or 150% (144 DPI) on a Windows laptop, Word rounds to fractional pixels and opens 1px gaps unless the email declares its DPI.
  • Your cache hides broken images. Your browser already has the hero image. A reader hitting a cold CDN, a rate limit or a missing header may not.

Step 1: check the code

The cheapest bug to fix is the one found before anything renders. A check of the compiled HTML takes seconds and covers:

  • CSS support. Properties that fail in clients you care about, such as display: flex in Outlook, position: absolute in Gmail or functions like clamp(). Paste your HTML into the CSS compatibility checker.
  • Size. Gmail clips HTML over 102KB; the email size checker measures it, and why Gmail clips emails covers how to get under it.
  • Accessibility. Layout tables with role="presentation", alt text on images and WCAG 2.1 AA contrast, in the accessibility checker.
  • Outlook conditional comments. An unclosed <!--[if mso]> or a missing half of a ghost table makes Outlook swallow the markup around it.

Step 2: preview while you build

Whether you build with React Email, MJML or by hand, you want a preview that updates as you type, not a screenshot that takes minutes. Check four widths:

  • 320px, a small phone: columns that don't stack, images that overflow, tap targets that are too small.
  • 375 to 414px, most current phones: buttons and type at a comfortable size once stacked.
  • 600 to 640px, the usual email width: ghost tables, side-by-side columns and hero images within their limits.
  • 1200px and up, webmail on a wide monitor: the email centred, not stuck to the left edge.

Check dark mode in the same pass. Apple Mail applies your prefers-color-scheme styles, while Gmail on Android and Outlook on Windows recolour the email themselves. The dark mode preview tool shows both; the fixes are in the dark mode email guide.

Step 3: see it in the real clients

Code checks and a browser preview find most problems, but each client family has quirks of its own. Outlook Classic on Windows lays out email with Word, the riskiest of the three: no max-width, flexbox, background images or rounded corners without fallbacks. Gmail runs a sanitizer that removes a <style> block it can't parse, rewrites class names and clips at 102KB. Apple Mail uses WebKit and supports nearly everything, though Mail Privacy Protection caches images, which affects live countdown timers.

A browser can't stand in for Word: Outlook's table, border and DPI rounding rules aren't CSS you can override in Chrome. Use a preview that applies them, and screenshots from real installs when it matters. Our comparison of our live preview with real clients shows where the two agree and where they don't. If something looks wrong, look it up by symptom in email rendering bugs.

Step 4: check the sending setup

A perfect render does nothing in the spam folder. Before launch, confirm the From domain passes SPF, DKIM and DMARC with alignment, that one-click unsubscribe headers (RFC 8058) are set, and that the plain-text part matches the HTML. The email deliverability guide explains the records; the deliverability checker and spam checker test them.

Automate it in CI

Test email templates like the rest of your code: a broken CSS property or a 2MB hero image should fail the pull request, not reach a customer. A short script with @emailens/engine covers step 1:

scripts/lint-email.ts
30 lines
// scripts/lint-email.ts
import { readFileSync } from "node:fs";
import { analyzeEmail, checkAccessibility, checkSize } from "@emailens/engine";

const html = readFileSync("./dist/newsletter.html", "utf-8");

// 1. Size: Gmail clips HTML over 102KB
const size = checkSize(html);
if (size.clipped) {
  console.error(`[FAIL] ${size.humanSize}: Gmail will clip this email.`);
  process.exit(1);
}

// 2. CSS support across email clients
const errors = analyzeEmail(html).filter((w) => w.severity === "error");
if (errors.length > 0) {
  console.error(`[FAIL] ${errors.length} rendering errors:`);
  for (const e of errors) {
    console.error(`  - [${e.client}] ${e.property}: ${e.message}`);
  }
  process.exit(1);
}

// 3. Accessibility: alt text, table roles, contrast
const a11y = checkAccessibility(html);
if (a11y.issues.length > 0) {
  console.warn(`[WARN] ${a11y.issues.length} accessibility warnings.`);
}

console.log("[PASS] Email passed the checks.");

Run it on every pull request that touches an email, alongside a screenshot comparison:

.github/workflows/email-qa.yml
30 lines
# .github/workflows/email-qa.yml
name: Email QA

on:
  pull_request:
    paths:
      - 'emails/**'

jobs:
  test-emails:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Bun
        uses: oven-sh/setup-bun@v2
        with:
          bun-version: latest

      - name: Install dependencies
        run: bun install --frozen-lockfile

      - name: Build email templates
        run: bun run build:emails

      - name: Lint email HTML
        run: bun scripts/lint-email.ts

      - name: Screenshot comparison
        run: bunx playwright test tests/email-snapshots.test.ts

The screenshot test renders the email at 375px and 1200px, fails on horizontal scroll or a container that grows past 600px, and compares against an approved image with a 1% tolerance. It checks your layout in a browser, not in Outlook, so it complements step 3 rather than replacing it.

tests/email-snapshots.test.ts
34 lines
// tests/email-snapshots.test.ts
import { test, expect } from "@playwright/test";
import { readFileSync } from "node:fs";

const html = readFileSync("./dist/welcome-email.html", "utf-8");

test("no horizontal scroll at 375px", async ({ page }) => {
  await page.setViewportSize({ width: 375, height: 812 });
  await page.setContent(html, { waitUntil: "networkidle" });

  const scrollWidth = await page.evaluate(
    () => document.documentElement.scrollWidth,
  );
  expect(scrollWidth).toBeLessThanOrEqual(375);

  await expect(page).toHaveScreenshot("welcome-mobile.png", {
    maxDiffPixelRatio: 0.01,
  });
});

test("container stays at 600px on a wide screen", async ({ page }) => {
  await page.setViewportSize({ width: 1200, height: 900 });
  await page.setContent(html, { waitUntil: "networkidle" });

  const width = await page
    .locator("table[align='center']")
    .first()
    .evaluate((el) => el.getBoundingClientRect().width);
  expect(width).toBeCloseTo(600, 1);

  await expect(page).toHaveScreenshot("welcome-desktop.png", {
    maxDiffPixelRatio: 0.01,
  });
});

If you'd rather not maintain the scripts, the Emailens CLI and GitHub Action run checks like these on every pull request; see open source.

The pre-send checklist

Run through this before a template goes to production or a campaign goes out. Each item links to the tool or guide that checks it.

Structure and CSS

  • HTML5 doctype, with the charset, viewport and color-scheme meta tags in the head.
  • Layout built from tables with role="presentation", not flexbox or grid.
  • Styles the layout depends on are inline; the head <style> block holds only media queries, hover and dark-mode rules, and stays under Gmail's 16KB.
  • No errors in the CSS compatibility checker for the clients your readers use.
  • Client targeting for Gmail or Outlook, if any, is scoped to that client rather than treated as a global Outlook failure.

Outlook Classic

  • Multi-column rows wrapped in ghost tables with explicit widths, and every <!--[if mso]> comment closed.
  • Background images have a VML fallback (VML background generator).
  • <o:PixelsPerInch>96</o:PixelsPerInch> in an Outlook-only block in the head, against hairline gaps on scaled Windows displays.
  • Background colours set with both the bgcolor attribute and CSS.
  • A font stack with system fallbacks, such as Arial, sans-serif, so Outlook does not fall back to Times New Roman.

Images

  • Explicit width and height attributes, and images saved at twice the displayed size for sharp screens.
  • Descriptive alt text, and a background colour behind each image for readers with images turned off.
  • Dark logos keep a light outline or glow so they stay visible when the client darkens the background.

Size, links and text

  • HTML under Gmail's 102KB clip, checked with the email size checker.
  • Absolute URLs only, no href="#" placeholders, and UTM parameters on every tracked link (link checker).
  • A plain-text part with the same content and the links written out.
  • Preheader text, followed by filler so body text doesn't leak into the inbox preview.

Dark mode and accessibility

  • Text contrast of at least 4.5:1 (WCAG 2.1 AA) in light mode and in dark mode.
  • Previewed in both modes in the dark mode preview tool.
  • The rest of the accessibility guide checked: lang attribute, alt text, table roles.

Sending setup

  • The From domain passes SPF, DKIM and DMARC with alignment (deliverability checker).
  • List-Unsubscribe and List-Unsubscribe-Post: List-Unsubscribe=One-Click headers for one-click unsubscribe (RFC 8058).
  • A pass through the spam checker.

Seen in the clients

  • Previewed in Outlook on Windows, Gmail and Apple Mail at the very least, at phone and desktop widths, in light and dark mode.

Which testing tool

Screenshot services such as Litmus and Email on Acid were built for marketing teams sending campaigns by hand; if you test from code and CI, compare them in Emailens vs Litmus and Emailens vs Email on Acid.

Questions

Why isn't a test send to my own inbox enough?

It shows one client, in one mode, at one screen size. It says nothing about Outlook Classic on Windows, which renders with Microsoft Word, about clients that recolour the email in dark mode, or about Windows display scaling. Forwarding it to colleagues doesn't help either: forwarding rewrites the markup, so they see the forward, not your email.

Can a browser preview show how Outlook will render my email?

No. Outlook Classic doesn't run a browser engine: it lays out email with Word, which has its own table, border and DPI rounding rules. Overriding CSS in Chrome can't reproduce that. You need a preview that applies Outlook's rules or a screenshot from a real Outlook install.

How do I test HTML emails automatically in CI?

Build the templates in your pipeline, run a script that fails the job when the HTML is over Gmail's 102KB clip or uses CSS your target clients don't support, then compare screenshots against approved ones. The workflow and a GitHub Actions example are in this post.

Your next question

Also useful: HTML email checker · Email Rendering Playground · Lint HTML emails in 21 clients

Paste the email that broke.

The checker needs a computer screen.

Get new email CSS fixes by email, or follow by RSS.