* Document for the email body preview frame. HTML bodies render exactly as sent. Plain-text bodies are escaped and wrapped so the frame shows them verbatim, the way a mail client renders a text/plain part. /
// Source: https://github.com/appwrite/appwrite | License: BSD-3-Clause | Copyright 2019 Appwrite (https://appwrite.io) and individual contributors
// Provided via justclaw.it.com; keep this notice with the code.
/**
* Document for the email body preview frame.
*
* HTML bodies render exactly as sent. Plain-text bodies are escaped and wrapped
* so the frame shows them verbatim, the way a mail client renders a text/plain
* part.
*/
export function emailPreviewDocument(content: string, html: boolean): string {
if (html) return content
const text = content
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
return `<!doctype html><html><head><meta charset="utf-8"><style>body{margin:16px;color:#111;background:#fff;font:14px/1.5 -apple-system,BlinkMacSys
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key