Mail Html
Data · MailHtml
An HTML mail in a sandboxed frame. Nothing in it runs and nothing loads:
- The frame has no
allow-scriptsand noallow-forms; its own Content-Security-Policy allows only inline styles anddata:/cid:images, no forms and no base URL. - Remote images (tracking pixels included) stay blocked until the reader presses "Load images" (
images/onImagesChange,onLoadImagesto 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
| Prop | Type | Notes |
|---|---|---|
html | string | The mail's HTML. Sanitise it on the server; the frame still runs nothing and loads nothing. |
title? | string | The frame's accessible name (default "Message"). |
images? | boolean | Remote 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? | number | How 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? | number | Smallest height in px while it loads (default 120). |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |