Skip to main content

Module email_render

Module email_render 

Source
Expand description

Render EmailTemplate instances to branded HTML + plain text.

Uses plain format! / write! interpolation. HTML interpolations for user-controlled strings go through html_escape::encode_safe to prevent stored XSS in email clients that render rich content (see plan §2.1). Text output is not escaped — clients render it literally.

§Exhaustiveness

The match in render has no wildcard arm. Because this module lives in the same crate as EmailTemplate, #[non_exhaustive] does not apply here, so the compiler enforces that every variant is handled. Adding a new variant to EmailTemplate will cause a compile error in render — that is intentional (plan §2.5): every variant must have an explicit branch.

Structs§

EmailBranding
Branding injected into rendered emails at sender-construction time.
RenderedEmail
HTML and plain-text output from render.

Functions§

render
Render template to RenderedEmail using branding.