Method SaveAsync
- Namespace
- MailFathom.Application.Mail.Delivery.Drafts
- Assembly
- MailFathom.Application.dll
SaveAsync(MailAccountId, OutgoingEmailRequester, ComposedMailDraft, MailDraftId?, CancellationToken)
Writes a composed draft down, as a new one or as the next revision of one that already exists.
public Task<MailDraftRecord> SaveAsync(MailAccountId accountId, OutgoingEmailRequester author, ComposedMailDraft composed, MailDraftId? revises, CancellationToken cancellationToken)
Parameters
accountIdMailAccountIdThe account the draft belongs to.
authorOutgoingEmailRequesterThe authored act writing it down.
composedComposedMailDraftThe composed message, its recipients, and the identity this revision carries.
revisesMailDraftId?The draft this replaces, or null to write a new one.
cancellationTokenCancellationTokenCancels the writes and the commands that follow them.
Returns
- Task<MailDraftRecord>
The draft as it stands once the mailbox has been brought into step with it.
Remarks
The revision is durable before any command reaches the mail server, which is what makes a replacement resumable: the record already says which copy is being replaced, so a process that dies between the append and the removal leaves one draft in the folder rather than two or none.
Exceptions
- ArgumentNullException
Thrown when
authororcomposedis null.- PrincipalNotAuthorizedException
Thrown when the act the author names is not what reached this.
- MailDraftRefusedException
Thrown when
revisesnames no draft of this account that is still being written.- PersistenceConcurrencyConflictException
Thrown when the write did not commit on any allowed attempt.