Table of Contents

Method FileAsync

Namespace
MailFathom.Application.Mail.Delivery.Filing
Assembly
MailFathom.Application.dll

FileAsync(OutgoingEmailRecord, OutgoingMailFiling, CancellationToken)

Files one copy of a message into the place its state calls for.

[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "A filing failure must never reach the delivery that preceded it, because a send whose copy could not be filed is a send that happened; the failure is classified into a recorded code and returned as an outcome rather than raised.")]
public Task<OutgoingMailFilingResult> FileAsync(OutgoingEmailRecord record, OutgoingMailFiling filing, CancellationToken cancellationToken)

Parameters

record OutgoingEmailRecord

The outgoing record the copy is filed from, read with its existing filings.

filing OutgoingMailFiling

Which place the copy goes into.

cancellationToken CancellationToken

Cancels the append and the writes around it.

Returns

Task<OutgoingMailFilingResult>

What the attempt did, which is already durable by the time it is returned.

Remarks

It does not raise for a copy that could not be filed. Everything the attempt learned is written onto the record first, so a caller reads the outcome rather than catching it — which is what lets a filing failure leave the delivery that preceded it exactly as it was.

Exceptions

ArgumentNullException

Thrown when record is null.

ArgumentException

Thrown when filing is the unspecified struct default.