s365b.core.mailview¶
Read a stored email (MIME) for display: headers, plain text, attachments.
Used by the browse view. Nothing here renders HTML: an HTML body becomes text, so a backed-up message cannot run script or load remote images in the admin’s browser.
Attributes¶
Classes¶
An email prepared for display. |
Functions¶
|
Convert HTML to readable plain text. |
|
Parse a MIME message for display. |
Module Contents¶
- s365b.core.mailview.html_to_text(html: str) str[source]¶
Convert HTML to readable plain text.
- Parameters:
html – An HTML document or fragment.
- Returns:
The visible text with paragraph breaks.
- class s365b.core.mailview.MessageView[source]¶
An email prepared for display.
- Variables:
subject – Subject.
sender – From.
to – To.
cc – Cc.
date – Date header as sent.
body – Plain-text body (HTML converted), possibly truncated.
body_was_html – The body came from an HTML part.
truncated – The body was cut at
MAX_BODYcharacters.attachments –
{"filename", "content_type", "size"}per attachment.
- s365b.core.mailview.read_message(raw: bytes) MessageView[source]¶
Parse a MIME message for display.
- Parameters:
raw – The message as stored (RFC 5322 / MIME).
- Returns:
Headers, plain-text body and attachment list.