Table of Contents

Class MailDocumentTexts

Namespace
MailFathom.Application.EmailContent.Rendering.Document
Assembly
MailFathom.Application.dll

Reads every text a document holds, and writes a document back with those texts replaced.

public static class MailDocumentTexts
Inheritance
MailDocumentTexts
Inherited Members

Remarks

It exists for one caller: the sensitive-content scan a read runs before mail leaves this deployment. The document is the third representation of a body, so it has to be guarded exactly as the other two are — and a tree cannot be handed to a scanner as one string, because a finding straddling the join between two runs would redact across words that have nothing to do with each other.

So the two halves are separated and the order between them is the contract: Collect(MailDocument) walks the tree in reading order and Rewrite(MailDocument, IReadOnlyList<string>) walks it again in the same order, taking the replacements positionally. A caller therefore guards a flat list and gets a tree back, and nothing in between has to understand a block.

What is collected is what the message's author wrote: the words of every run, the text of every preformatted block, and what a picture says it shows. A link's target is not among them, for the reason an address is not scanned anywhere else here — it is a routing identity a reader acts on rather than free text, and redacting it would remove the reader's ability to see where a link goes while protecting nothing the words did not already carry.

Methods

Collect(MailDocument)

Reads every text the document holds, in reading order.

Rewrite(MailDocument, IReadOnlyList<string>)

Writes the document back with every text replaced by the one at its position.