Table of Contents

Class OutgoingMailFiler

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

Puts a copy of an outgoing message into the folder the message's own state calls for.

public sealed class OutgoingMailFiler
Inheritance
OutgoingMailFiler
Inherited Members

Remarks

One mechanism for every place a message MailFathom authored belongs: a draft in the drafts folder, a message still waiting in the folder an operator mapped as the outbox, a delivered message in the sent folder. What differs between them is the role of the destination and the flags the copy carries, and both travel on OutgoingMailFiling — so a fourth place is a member there rather than a second filer here.

The destination is found by role and never by name, because every one of these folders is spelled differently in every locale and by every provider. A role no folder of the account plays is a destination that is not available, which is the same answer a mapped folder the server does not advertise gives: the account's folder mapping is what changes it, and the message is untouched either way.

The order of the two writes is the whole of the safety here. An APPEND issued twice is a second message in somebody's folder rather than a repeat of the first, and nothing that folder shows afterwards tells the two apart — so the row is durable at Issued before the command goes out, and a row found there is reported rather than appended again. Everything that can fail without reaching the server happens before that write, which is what keeps an ordinary connection failure retryable.

Nothing here can fail a delivery. A send whose copy could not be filed is a send that happened, so the failure is written beside the delivery stage rather than over it, and no delivery is ever attempted again because of one.

Constructors

OutgoingMailFiler(IMailboxWriteSessionFactory, MailboxDestinationResolver, IEmailContentStore, IOutgoingMailFilingStore, IMailTransportSecurityPolicyReader, OptimisticConcurrencyRetryPolicy, TimeProvider)

Initializes the filer from the session it appends through and the record it writes the copy onto.

Methods

FileAsync(OutgoingEmailRecord, OutgoingMailFiling, CancellationToken)

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

WithdrawAsync(OutgoingEmailRecord, OutgoingMailFiling, CancellationToken)

Takes a copy back out of the folder it was filed into.