Table of Contents

Method ReadMetadataAsync

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

ReadMetadataAsync(MailAccountId, ReadOnlyMemory<byte>, CancellationToken)

Reads one message's normalized metadata.

public Task<EmailMimeExtractionResult> ReadMetadataAsync(MailAccountId account, ReadOnlyMemory<byte> rawMime, CancellationToken cancellationToken)

Parameters

account MailAccountId

The account the message belongs to, which every path reaching this port already holds.

rawMime ReadOnlyMemory<byte>

The raw MIME already fetched or already stored for the message.

cancellationToken CancellationToken

Cancels the read.

Returns

Task<EmailMimeExtractionResult>

The metadata, or the reason the message could not be read.

Remarks

Content that does not parse, declares more parts than the configured limit, or nests deeper than it returns as a failure result rather than as an exception, so one unreadable message never stops a synchronization batch.

The account is named rather than the place a mail server holds the message, because it is a fact about the derivation rather than about the bytes: which mailbox it is decides how a body is redacted and whose authentication statements are believed, while a stored message a server no longer holds is read exactly as one it still does. Every caller holds the answer — synchronization is running one account and a re-derivation walk carries it on each row — so nothing resolves it a second time.