Table of Contents

Method ExtractTextAsync

Namespace
MailFathom.Application.Emails.Extraction.Attachments
Assembly
MailFathom.Application.dll

ExtractTextAsync(IOpenedEmailAttachment, CancellationToken)

Reads the text of one opened attachment.

Task<AttachmentTextExtractionResult> ExtractTextAsync(IOpenedEmailAttachment attachment, CancellationToken cancellationToken)

Parameters

attachment IOpenedEmailAttachment

The attachment, opened from stored content and owned by the caller.

cancellationToken CancellationToken

Cancels the extraction.

Returns

Task<AttachmentTextExtractionResult>

The text the attachment yielded, or the reason it yielded none.

Remarks

A failure reading the attachment's stored content propagates as whatever the content store raised, rather than becoming an outcome. Every outcome here is a durable fact about the document — the caller may record one against the attachment and never look again — and a database or object-storage fault is a transient fact about this attempt, so reporting one as Malformed would write a broken document into the record on the strength of a connection that dropped. Only what a parser does with the octets once they have arrived becomes a reason.

Exceptions

ArgumentNullException

Thrown when attachment is null.

OperationCanceledException

Thrown when cancellationToken is cancelled. The configured timeout elapsing is reported as TimedOut instead, because that is a fact about the attachment rather than about the caller.