Table of Contents

Class EmailBodyRepresentation

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

One representation of a message body, together with what was left out of it.

public sealed record EmailBodyRepresentation : IEquatable<EmailBodyRepresentation>
Inheritance
EmailBodyRepresentation
Implements
Inherited Members

Remarks

Truncation is part of the value rather than a flag beside it, because a body and the fact that it is incomplete are never useful apart: a caller handed only the text would have to guess whether it read a whole message, which is exactly what the specification forbids. Both representations a reader can receive — the plain text and the sanitized HTML — carry their own copy, since a message can exceed the bound in one and not in the other.

Truncation names the bound rather than merely reporting that there was one, because a read of several emails is subject to two of them and the answer to "ask for less at once" differs from the answer to "this message is longer than any single call returns".

It is stated rather than derived from the two lengths, because the HTML representation is bounded on its source markup and then re-serialized: the returned text can be shorter than the source it was cut from, or slightly longer once the parser closes what the cut left open, and neither difference is truncation.

Constructors

EmailBodyRepresentation(string, int, EmailBodyTruncation)

One representation of a message body, together with what was left out of it.

Properties

Empty

Gets the representation of a body that displayed nothing.

OriginalCharacterCount

How many characters the source of this representation held before the bound was applied.

Text

The representation as it is returned, already bounded.

Truncation

Which bound removed something, or that none did.

WasTruncated

Gets whether any bound removed something from this representation.

Methods

Bounded(string, EmailBodyCharacterAllowance)

Bounds one text to the characters a reader may be handed.