Skip to content
Twentyfirst UIPro

Mail Html

Data · MailHtml

View as Markdown

An HTML mail in a sandboxed frame. Nothing in it runs and nothing loads:

  • The frame has no allow-scripts and no allow-forms; its own Content-Security-Policy allows only inline styles and data:/cid: images, no forms and no base URL.
  • Remote images (tracking pixels included) stay blocked until the reader presses "Load images" (images/onImagesChange, onLoadImages to remember the sender).
  • Links open in a new tab without a referrer.
  • The height follows the content.
  • appearance="paper" (default) keeps the mail on light paper in every theme, as senders design it; "theme" paints plain mails in the page's colours, dark in the dark theme.

Sanitise the HTML on your server as well; the frame is the second line of defence.

1 remote image is blocked to protect your privacy.

Props

MailHtml

PropTypeNotes
htmlstringThe mail's HTML. Sanitise it on the server; the frame still runs nothing and loads nothing.
title?stringThe frame's accessible name (default "Message").
images?booleanRemote images loaded (controlled) / initially / when the reader loads them.
defaultImages?boolean
onImagesChange?(images: boolean) => void
onLoadImages?() => void"Load images" was pressed (e.g. to remember the sender).
blockedImages?numberHow many remote images are blocked (default: counted in `html`).
appearance?"paper" | "theme"`"paper"` (default): the mail keeps its own light paper in every theme, as senders design it. `"theme"`: the page's surface and text colours, dark in the dark theme (for plain mails).
minHeight?numberSmallest height in px while it loads (default 120).
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.