Table of Contents

Method OpenForDeliveryAsync

Namespace
MailFathom.Application.Mail.Delivery
Assembly
MailFathom.Application.dll

OpenForDeliveryAsync(MailAccountId, MailTransportSecurityPolicy, CancellationToken)

Connects and authenticates against the account's submission server.

Task<IMailDeliverySession> OpenForDeliveryAsync(MailAccountId accountId, MailTransportSecurityPolicy transportSecurityPolicy, CancellationToken cancellationToken)

Parameters

accountId MailAccountId

The local account identifier.

transportSecurityPolicy MailTransportSecurityPolicy

The connection and authentication policy the implementation must obey.

cancellationToken CancellationToken

Cancels resolving the credential, connecting, and authenticating.

Returns

Task<IMailDeliverySession>

An open delivery session the caller owns and must dispose.

Remarks

The policy is an input rather than something the implementation resolves, so an adapter cannot widen the permitted authentication mechanisms or downgrade the connection on its own. It is the account's own policy with the submission endpoint's connection security in it, because a provider that serves reading over implicit TLS commonly serves submission over STARTTLS, while which credentials may cross either channel is one decision.

Exceptions

ArgumentNullException

Thrown when transportSecurityPolicy is null.

InvalidOperationException

Thrown when the account configures no submission endpoint, which startup validation settles for every configured account.

MailDeliveryUnavailableException

Thrown when the submission server did not accept the session within its configured resilience budget.