# Mail Html

> An HTML mail in a sandboxed frame.

Component · Data · Halo kit · [Live page](https://ui.twentyfirst.media/halo/components/MailHtml/)

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.

## Example

```tsx
import { MailHtml } from "@twentyfirstmedia/halo";
import { NEWSLETTER_HTML } from "./_mail";

export default function Preview() {
  return (
    <div className="tf-panel" style={{ gap: 12 }}>
      <MailHtml html={NEWSLETTER_HTML} title="The weekly digest" />
    </div>
  );
}
```

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