← Back to all products
$29
Email Preview Renderer
Render HTML emails and check compatibility across email clients before sending.
PythonMarkdown
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 10 files
email-preview-renderer/
├── LICENSE
├── README.md
├── examples/
│ └── sample_email.html
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_quick-start.md
│ ├── 03_audit-report.md
│ └── 04_faq.md
├── index.html
└── src/
└── email_preview_renderer.py
📖 Documentation Preview README excerpt
Email Preview Renderer
Render HTML emails and check compatibility across different email clients. Catch layout bugs before you hit send.
Features
- Email client rules — Built-in rendering profiles for Outlook Desktop, Gmail, Apple Mail, Yahoo Mail, and Outlook Web
- HTML auditing — Checks accessibility, CSS compatibility, and common rendering issues
- CSS inlining — Converts
blocks to inline styles for maximum compatibility - Local preview server — Spins up a local HTTP server to view your email in a browser
- Rendering issue detection — Flags unsupported CSS properties per client
- Accessibility checks — Verifies alt text, lang attribute, and semantic structure
- JSON reports — Machine-readable audit results
Requirements
- Python 3.10+
- No external dependencies (stdlib only)
Quick Start
# Preview an HTML email in your browser
python src/email_preview_renderer.py render examples/sample_email.html
# Audit for rendering issues across all clients
python src/email_preview_renderer.py audit examples/sample_email.html --output report.json
# Inline CSS for better compatibility
python src/email_preview_renderer.py inline examples/sample_email.html --output inlined.html
Email Client Profiles
The audit checks your HTML against these clients' known limitations:
| Client | Engine | Key Limitations |
|---|---|---|
| Outlook Desktop | Word rendering | No border-radius, no flexbox/grid, no background-image, no max-width |
| Gmail | Custom | Strips <style> blocks, no media queries, limited pseudo-selectors |
| Apple Mail | WebKit | Generally good — flags large images and missing alt text |
| Yahoo Mail | Custom | Rewrites CSS class names, limited @media support |
| Outlook Web | Browser | No position:absolute, limited background-image |
Audit Report
The audit command produces a structured report:
{
"file": "template.html",
"issues": [
{
"client": "Outlook Desktop",
"severity": "high",
"property": "border-radius",
"message": "border-radius is not supported in Outlook Desktop (Word engine)"
},
{
"client": "all",
*... continues with setup instructions, usage examples, and more.*
📄 Code Sample .py preview
src/email_preview_renderer.py
#!/usr/bin/env python3
"""
Email Preview Renderer — Email Arsenal (DataNest)
Renders HTML emails and checks rendering compatibility across different
email clients. Identifies common rendering issues before you send.
Usage:
python email_preview_renderer.py render template.html
python email_preview_renderer.py audit template.html --output report.json
python email_preview_renderer.py inline template.html --output inlined.html
Dependencies: Python 3.10+ stdlib only
License: MIT
"""
from __future__ import annotations
import argparse
import html
import http.server
import json
import logging
import re
import sys
import threading
import webbrowser
from dataclasses import asdict, dataclass, field
from html.parser import HTMLParser
from pathlib import Path
from typing import Any
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
logger = logging.getLogger("email_preview_renderer")
PREVIEW_PORT = 8642 # Default port for local preview server
# Email client rendering rules — maps client names to their known limitations.
# This is the core value of this tool: knowing what breaks where.
CLIENT_RULES: dict[str, dict[str, Any]] = {
"outlook_desktop": {
"name": "Outlook Desktop (Word engine)",
"css_unsupported": [
"background-image", "border-radius", "box-shadow",
"text-shadow", "opacity", "rgba", "hsla",
"position:relative", "position:absolute", "position:fixed",
"display:flex", "display:grid", "max-width",
# ... 556 more lines ...