Method SaveAsync
- Namespace
- MailFathom.Application.Mail.Delivery.Drafts
- Assembly
- MailFathom.Application.dll
SaveAsync(MailAccountId, UserId, 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 account, UserId writtenBy, OutgoingEmailRequester author, ComposedMailDraft composed, MailDraftId? revises, CancellationToken cancellationToken)
Parameters
accountMailAccountIdThe account the draft belongs to, by its generated identifier.
writtenByUserIdThe user writing it, who is the one person among the account's assigned users who reads it.
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 thatwrittenBywrote and is still being written, or when the message carries material this deployment screens outgoing mail for.- SensitiveContentScannerUnavailableException
Thrown when a switched-on scanner could not establish what the message carries, which refuses the draft rather than filing it unscreened.
- PersistenceConcurrencyConflictException
Thrown when the write did not commit on any allowed attempt.