Method EnqueueAsync
- Namespace
- MailFathom.Application.Mail.Delivery
- Assembly
- MailFathom.Application.dll
EnqueueAsync(OutgoingEmailRequest, ReadOnlyMemory<byte>, CancellationToken)
Writes down a message to be sent, or answers with the record an identical request already left.
public Task<OpenedOutgoingEmail> EnqueueAsync(OutgoingEmailRequest request, ReadOnlyMemory<byte> rawMime, CancellationToken cancellationToken)
Parameters
requestOutgoingEmailRequestThe send that was asked for.
rawMimeReadOnlyMemory<byte>The composed RFC 822 bytes to transmit, stored once and read back for every attempt.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<OpenedOutgoingEmail>
The durable record for this request, and whether this call is what wrote it down.
Remarks
The message is not recomposed for a request that already has a record, and the bytes supplied here are then
ignored rather than written over the stored ones. That is what keeps a resumed send one message: a
Message-ID that changed between attempts would thread as a second message in every recipient's client.
Exceptions
- ArgumentNullException
Thrown when
requestis null.- ArgumentException
Thrown when
rawMimeis empty.- PrincipalNotAuthorizedException
Thrown when the act the request names as its origin is not what reached this: a caller granted MailSend for a command, and MailFathom's own identity for a rule.
- OutgoingMailRefusedException
Thrown when sending is not enabled for the account or the deployment is read-only, when a recipient is one the recipient policy refuses, or when the period has reached a ceiling.
- PersistenceConcurrencyConflictException
Thrown when the write lost its race for the same identity on every allowed attempt.