Strict Mode
Strict mode is enabled by default in render(). It is meant to fail early on markup, CSS, and image formats that are unsupported or risky for HTML email clients.
hono-email uses dynamic compatibility data derived from caniemail.com to analyze your markup.
Validation Scope
Section titled “Validation Scope”The validation engine checks the following items:
- HTML Tags & Attributes: Interactive or dangerous elements (like
<script>,<iframe>) and attributes. - CSS Properties & At-Rules: Unsupported declarations (like
display: grid) or risky layouts. - Image Formats: Compatibility checks for image formats such as
webp,avif,svg, andbase64.
Global Compatibility Thresholds
Section titled “Global Compatibility Thresholds”By default, hono-email checks compatibility using global support ratios derived from caniemail.com. Features that have extremely poor support across all clients will trigger strict-mode errors (blocking render) or compatibility warnings.
Warning Clients Configuration
Section titled “Warning Clients Configuration”To get additional client-specific compatibility warnings for features that are unsupported or only partially supported in certain environments, configure the warningClients option:
const result = await render(<MyEmail />, { strict: true, warningClients: ['gmail', 'apple-mail'], // Get extra warnings for Gmail and Apple Mail})By default, warningClients is [] (no additional client-specific warnings are generated unless configured).
Errors & Warnings Behavior
Section titled “Errors & Warnings Behavior”- Errors: Hard failures (like interactive tags or missing required fields) reject the
render()promise. - Warnings: Features that have limited support or quirks on target clients produce compatibility warnings on
RenderResult.warnings.
Warnings are surfaced according to the onWarning option.
Disabling strict mode
Section titled “Disabling strict mode”You can disable strict validation, but doing so means hono-email will no longer protect you from markup that is likely to break in email clients.
const { html } = await render(<MyEmail />, { strict: false })