Table of Contents

Method ClassifyAsync

Namespace
MailFathom.Application.Spam
Assembly
MailFathom.Application.dll

ClassifyAsync(MailAccountId, StoredEmailId, SpamClassificationMode, CancellationToken)

Classifies one occurrence, on the terms decided for the mailbox it belongs to.

public Task<SpamClassificationResult> ClassifyAsync(MailAccountId account, StoredEmailId emailId, SpamClassificationMode mode, CancellationToken cancellationToken)

Parameters

account MailAccountId

The account whose posture decides everything below. The email is read only within this account's mail, so an account which does not hold it finds nothing and the attempt ends as OccurrenceMissing.

emailId StoredEmailId

The occurrence to classify.

mode SpamClassificationMode

What to do about an occurrence that already carries a classification.

cancellationToken CancellationToken

Propagates caller cancellation.

Returns

Task<SpamClassificationResult>

What was recorded, or the reason nothing was.

Remarks

The order of the checks is the order of what they cost. Whether this account is classified at all is free, then the email is looked up within the account's own mail — an email the account does not hold ends here, before anything else about it is read — then the scope and the existing record are one lookup each, and only then is content read, so an occurrence outside the scope costs no read of its mail, which is the property that keeps a switched-off feature free.

Exceptions

ArgumentOutOfRangeException

Thrown when mode is not a defined member.

PersistenceConcurrencyConflictException

Thrown when every allowed commit attempt conflicted.