Skip to content

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.

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, and base64.

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.

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: 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.

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 })