Method FileAsync
- Namespace
- MailFathom.Application.Mail.Delivery.Filing
- Assembly
- MailFathom.Application.dll
FileAsync(IPersistenceSession, LocalMailCopy, OutgoingEmailId?, CancellationToken)
Files a prepared copy into the local folder playing its role, inside the transaction it belongs to.
public Task<FiledLocalEmail?> FileAsync(IPersistenceSession session, LocalMailCopy copy, OutgoingEmailId? filedFrom, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe transaction that settles the draft revision or the delivery.
copyLocalMailCopyThe prepared copy.
filedFromOutgoingEmailId?The outgoing record a sent copy is filed from, or null for a draft.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task<FiledLocalEmail>
What was filed, or null where the account is no longer held or the binding the copy was prepared against is gone.
Remarks
The protected folders are supplied where the account is missing them, for the reason an arrival supplies them. The hierarchy is saved only then: a protected folder cannot be erased, so a filing that supplied nothing has no edit to conflict with, and saving anyway would make every draft save conflict with every arrival.
Nothing here raises for a binding the drain removed after the copy was prepared: the transaction commits what the copy belongs to without it, which a delivery the submission server already took depends on.
Exceptions
- ArgumentNullException
Thrown when
copyis null.