Sub topic 14
Testing across clients and devices
This chapter assumes you can write table-based email HTML with inline CSS and media queries. You should also know the Outlook conditional comments, dark mode styles, and preheader markup covered in earlier chapters. Here you will build a routine that checks all of that before you send.
Why email needs its own test routine
A web page is tested in a handful of browsers that share standards. An email is rendered by many different engines. Desktop Outlook on Windows uses the Word engine. Apple Mail uses WebKit. Gmail rewrites your markup and may strip parts of it. Some clients also change colors in dark mode on their own.
Because of this, a template that looks right in one client can break in another. Testing is how you find those differences before your readers do.
You cannot test every client and device. The goal is to cover the clients that matter for your audience and to catch the failures that are most common.
Choose a client matrix
A client matrix is a list of the clients, devices, and settings you will check on every release. Build it from your own data, not from guesses.
- Pull open data from your email service provider. Group opens by client and device.
- Keep the clients that make up most of your opens.
- Add one client per rendering engine, even if its share is small. This catches problems that would affect many related clients.
- Add the settings that change rendering: dark mode on and off, and images blocked.
A starting matrix might look like this:
| Client | Engine or behavior | Why it is on the list |
|---|---|---|
| Apple Mail (iOS and macOS) | WebKit, full media query support | Large mobile share, sets the baseline |
| Gmail app (Android and iOS) | Rewrites markup, limited support in some account types | Large share, strict CSS handling |
| Gmail in a web browser | Strips some CSS, supports embedded styles | Common on desktop |
| Outlook for Windows (desktop) | Word engine, ignores `max-width` on divs | Most layout failures happen here |
| Outlook.com and Outlook mobile | Modern engine, own dark mode behavior | Large share among business users |
| Samsung Mail | Own dark mode color changes | Common on Android phones |
Update the matrix every few months. Client behavior and your audience both change.
Three ways to test
You can combine three methods. Each one finds different problems.
Preview services
Preview services such as Litmus and Email on Acid render your HTML in many real clients and return screenshots. They are fast and cover the clients you do not own. Screenshots can still differ slightly from a real inbox. Use them to find layout breaks, then confirm important ones on a real device.
Real devices and accounts
Send the email to test accounts and open it on real phones. This shows things screenshots miss: tap target size, scrolling, how the preheader looks in the inbox list, and how the app handles dark mode.
Keep a small set of test accounts, for example a Gmail account, an Outlook.com account, and an iCloud account. Open the message on at least one iPhone and one Android phone.
Local checks before sending
Some problems you can find without any client. Run these first because they are cheap.
- Validate that tags are closed and that tables nest correctly. A missing
</td>breaks layouts in strict engines. - Check that every
<img>hasalt,width, anddisplay:block. - Check that every link works and points to the right place.
- Check the HTML size. Gmail clips messages when the HTML grows past about 102 KB, and it hides the end behind a "View entire message" link.
The size check is easy to automate. This Python script reports the HTML size and flags images that have no alt attribute.
import sys
from html.parser import HTMLParser
LIMIT_BYTES = 102 * 1024
class ImageChecker(HTMLParser):
def __init__(self):
super().__init__()
self.missing_alt = []
def handle_starttag(self, tag, attrs):
if tag == "img":
names = {name for name, _ in attrs}
if "alt" not in names:
src = dict(attrs).get("src", "(no src)")
self.missing_alt.append(src)
def main(path):
with open(path, "rb") as f:
raw = f.read()
size = len(raw)
print(f"Size: {size} bytes ({size / 1024:.1f} KB)")
if size > LIMIT_BYTES:
print("WARNING: over the Gmail clipping limit")
checker = ImageChecker()
checker.feed(raw.decode("utf-8"))
for src in checker.missing_alt:
print(f"WARNING: image without alt: {src}")
if not checker.missing_alt and size <= LIMIT_BYTES:
print("OK")
if __name__ == "__main__":
main(sys.argv[1])Run it with python check_email.py email.html. An image with an empty alt="" passes, which is correct for purely decorative images.
A repeatable test workflow
The order of checks matters. Cheap checks come first so that you do not spend preview credits on a broken file.
What to look for in each client
Use the same checklist each time so that results are comparable. Group the checks by the concepts from earlier chapters.
Layout
- Does the layout fit the screen width with no horizontal scrolling?
- In desktop Outlook, is the container 600px wide and centered? If not, check the conditional comment table.
- Do columns stack on phones in clients that support media queries? In clients that do not, is the fallback layout still readable?
- Are padding and spacing intact? Some clients drop padding on certain elements. Putting padding on
tdcells is the most reliable approach.
Typography and touch
- Is body text at least 14px, and ideally 16px, on a phone?
- Does the client resize text on its own? iOS may enlarge text unless
-webkit-text-size-adjustis set. Check that your headings still fit. - Are buttons and links easy to tap? Aim for a target of about 44 by 44 pixels, with space between neighboring links.
Images
- Turn images off and reopen the message. Is the content still understandable from the alt text and background colors?
- Do buttons keep their color and label? A bulletproof button should, because it is built from a table cell and text.
- On high-density screens, are images sharp? Images exported at twice their display size look sharper.
- Are there gaps between stacked images? A missing
display:blockis the usual cause.
Dark mode
Check dark mode in each client that supports it. Clients handle it in three ways:
- No change. The email appears as designed.
- Partial inversion. The client darkens light backgrounds and leaves dark ones.
- Full inversion. The client changes most colors.
For each one, check these points:
- Text stays readable against its background.
- Logos with a transparent background do not disappear. A dark logo on a dark background is a common failure. A light outline or a version with a light border helps.
- Colors you set with
prefers-color-schemeapply in clients that honor it.
Preheader
- Does the inbox list show the preheader you wrote, followed by padding rather than body text?
- Is the preheader hidden when the message is opened?
Accessibility
- Is the
langattribute set on thehtmlelement? - Do layout tables have
role="presentation"? - Does the text contrast with its background by at least 4.5 to 1 for body text?
- Does a screen reader read the content in a logical order? Test with VoiceOver on iOS or TalkBack on Android.
Common errors found in testing
The same few errors appear again and again. Knowing them speeds up debugging.
| Symptom | Likely cause | Fix |
|---|---|---|
| Layout is wider than the screen on phones | Fixed `width` on a table with no `max-width` | Use `width:100%;max-width:600px` |
| Columns do not stack in Gmail app | Account type does not support embedded styles | Use a hybrid layout that stacks without media queries |
| Container is full width in desktop Outlook | Outlook ignores `max-width` on divs | Wrap in a conditional comment table |
| Button loses its color | Color set only on the link | Put `bgcolor` on the table cell |
| Text is too small on iPhone | Font under 14px, or text size adjustment changed it | Raise the size and set text size adjust |
| Blue links appear in iOS | Auto-detected phone numbers or addresses | Style the detected link or wrap it in a span with a set color |
| Dark mode hides the logo | Transparent PNG with dark artwork | Add a light outline or provide a dark mode version |
| Message clipped in Gmail | HTML over about 102 KB | Remove unused CSS and comments, shorten markup |
Handling failures
When a check fails, decide how much it matters before you spend time on it.
- Is the content readable and are the links usable? If yes, a small visual difference is acceptable.
- Does the failure hit a large share of your audience? If it does, fix it.
- Can you fix it with a fallback that does not harm other clients? Prefer fixes that degrade gracefully.
Aim for a good experience everywhere and a polished one in the clients that most readers use. Pixel-identical rendering across all clients is not a realistic goal.
Keep a regression record
When you fix a bug, record it. A short log of the symptom, the client, and the fix saves time on the next template. Over time it becomes a checklist tuned to your own templates.
Summary of the routine
- Run local checks for markup, alt text, links, and size.
- Render in a preview service across your client matrix.
- Check dark mode and blocked images in each client.
- Send to real accounts and open on at least one iPhone and one Android phone.
- Fix failures in order of audience impact, then repeat from step 1.
- Log what you found.
Exercise
Your preview service shows that a two-column template stacks correctly on iPhone but stays as two narrow columns in the Gmail app on an Android phone. Name the likely cause and two ways to handle it.
Show answer
The Gmail app on some account types does not apply embedded style blocks, so the media query that stacks the columns never runs. One fix is to use a hybrid layout, where the columns are built to wrap on their own without a media query, for example inline-block cells with a set max-width. A second option is to design the two columns so they remain readable when narrow, and to treat stacking as an enhancement for clients that support media queries. Confirm the result on a real device afterward.
Exercise
A message passes the preview service but readers on iPhone report that the logo is missing in dark mode. What check did the test routine miss, and what would you change?
Show answer
The dark mode check for transparent images was missed. The logo is likely a transparent PNG with dark artwork, so it disappears when the client darkens the background. Fix it by adding a light outline or a light border around the artwork, or by serving a version suited to dark backgrounds. Add a dark mode check with the logo visible to the regression log and the client matrix.
Exercise
Why should local checks run before the preview service in the workflow?
Show answer
Local checks are free and fast, and they catch errors such as missing alt text, unclosed tags, broken links, and oversized HTML. Running them first avoids using preview credits and review time on a file that would fail anyway, and it keeps the preview results focused on real client differences.