Method CancelAsync
- Namespace
- MailFathom.Application.Mail.Delivery
- Assembly
- MailFathom.Application.dll
CancelAsync(OutgoingEmailId, CancellationToken)
Withdraws a message that has not begun to leave, and says what became of the request.
public Task<OutboxDecisionOutcome> CancelAsync(OutgoingEmailId outgoingEmailId, CancellationToken cancellationToken)
Parameters
outgoingEmailIdOutgoingEmailIdThe record to withdraw.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<OutboxDecisionOutcome>
What became of the request, which is an answer rather than a failure in every case.
Remarks
The grant asked for is the one that lets a caller send, because stopping a message is a decision about somebody else's mail exactly as sending one is: whoever may write to this mailbox's correspondents is who may decide that a message they wrote will not go. That is the whole of what separates this from the operator's withdrawal, which asks the same question of the same record under an administrative grant; the transition itself is written once, by the statement behind CancelAsync(OutgoingEmailId, CancellationToken), so neither caller can withdraw a message the other could not.
It withdraws one message and never a declaration behind it. A cancelled occurrence of a recurring send stops that occurrence, and the next occasion produces a message as it always would — which is why stopping the declaration is an act of its own with a name of its own, rather than something this call could be asked to mean as well.
Exceptions
- PrincipalNotAuthorizedException
Thrown when the caller does not hold MailSend.