mail-html
Sanitises mail HTML for display: allowlist cleaner, cid rewrite, remote-image blocking, plain-text rendering and attachment headers.
Built and tested in the harness, and not in the public repository yet. The install line and the source link appear here when it is.
What it is
mail-html.
Makes mail HTML safe to show, and the headers that go with serving it. sanitize keeps an allowlist of tags and attributes, drops script, frames, forms, SVG and MathML, keeps only safe URL schemes, rewrites cid: parts to the caller’s attachment URLs, and blocks remote images unless they are allowed. to_text renders the same mail as plain text for search and previews. The crate also supplies the Content-Security-Policy and iframe sandbox for the page that shows the HTML, and the disposition and content type for attachment downloads. The caller adds the remaining response headers. It is pure, with no I/O, and builds for wasm32.
From the crate’s own README.
History
Changelog.
Not released yet. Its changelog starts with its first release.
One of 95 crates in the harness, all of them MIT.