Method TransmitAsync
- Namespace
- MailFathom.Application.Mail.Delivery
- Assembly
- MailFathom.Application.dll
TransmitAsync(MailTransmissionRequest, MailEnvelopeLedger, CancellationToken)
Offers the envelope and transmits the message, reporting what the server said about each.
Task<MailTransmission> TransmitAsync(MailTransmissionRequest request, MailEnvelopeLedger envelope, CancellationToken cancellationToken)
Parameters
requestMailTransmissionRequestWho the message is from, who is still owed it, and the bytes to transmit.
envelopeMailEnvelopeLedgerFilled with what the server answers about each address, whether or not this call returns.
cancellationTokenCancellationTokenCancels the submission; the record the caller holds decides what a cancelled one means.
Returns
- Task<MailTransmission>
What the server answered about the message.
Remarks
It is called once per attempt and never repeated inside one. A submission that failed part-way cannot be told apart from one that succeeded, so repeating it here would put a second copy in the mailbox of everybody the envelope had already reached — which is why the delivery pipeline repeats a server's explicit temporary rejection and nothing else.
A server that answered produces a result whatever it said, including a refusal, because either answer settles what the recipients received. Only a server that answered nothing raises — and the envelope ledger is what the caller reads then, since an envelope that accepted nobody is proof that no byte of the body went out.
Exceptions
- ArgumentNullException
Thrown when
requestorenvelopeis null.- MailDeliveryUnavailableException
Thrown when the exchange failed with the server stating nothing — a protocol violation, a socket failure, or a transport error. No resilience pipeline stands behind this call, so it is the transport's own failure rather than an exhausted retry budget.
- TimeoutException
Thrown when the submission outlived the budget its own stage is given, which says nothing about what the server received. That budget covers offering the envelope and transmitting the body together, and the attempt's own timeout bounds it from outside.
- OperationCanceledException
Thrown when the caller stopped waiting, which likewise says nothing about what the server received.