Method WithdrawAsync
- Namespace
- MailFathom.Application.Mail.Delivery.Filing
- Assembly
- MailFathom.Application.dll
WithdrawAsync(OutgoingEmailRecord, OutgoingMailFiling, CancellationToken)
Takes a copy back out of the folder it was filed into.
[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "A copy that could not be withdrawn is one message left in a folder the operator mapped; raising would end the pass that was settling the send it belongs to, over a failure that says nothing about the send.")]
public Task<OutgoingMailFilingResult> WithdrawAsync(OutgoingEmailRecord record, OutgoingMailFiling filing, CancellationToken cancellationToken)
Parameters
recordOutgoingEmailRecordThe outgoing record the copy was filed from, read with its existing filings.
filingOutgoingMailFilingWhich place the copy was in.
cancellationTokenCancellationTokenCancels the withdrawal and the write that records it.
Returns
- Task<OutgoingMailFilingResult>
What the attempt did.
Remarks
A copy the server never named cannot be reached, because nothing identifies it: the alternative would be searching the folder for something that looks like the message, which is a guess about identity rather than a fact. Such a row is marked withdrawn all the same, so nothing tries forever — what is left behind is one copy of the owner's own message in a folder they mapped, which they delete with the gesture they would have used anyway.
A folder that no longer holds the copy is not a failure. The owner deleting it themselves is the ordinary case, and what the withdrawal asked for is already true.
An append whose answer never came back is the one thing this does not settle, for the reason nothing appends it again: nobody knows whether the copy is in the folder, and recording it withdrawn would be MailFathom stating that it is not. The row stays where the issued write left it and the outcome says so, which is the same answer filing gives about the same row — the ambiguity is what an operator has to see, and it is visible only while something still reports it.
Exceptions
- ArgumentNullException
Thrown when
recordis null.- ArgumentException
Thrown when
filingis the unspecified struct default.