Constructor EmailBodyRepresentation
- Namespace
- MailFathom.Application.EmailContent.Rendering
- Assembly
- MailFathom.Application.dll
EmailBodyRepresentation(string, int, EmailBodyTruncation)
One representation of a message body, together with what was left out of it.
public EmailBodyRepresentation(string Text, int OriginalCharacterCount, EmailBodyTruncation Truncation)
Parameters
TextstringThe representation as it is returned, already bounded.
OriginalCharacterCountintHow many characters the source of this representation held before the bound was applied.
TruncationEmailBodyTruncationWhich bound removed something, or that none did.
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.