Table of Contents

Method OpenForWritingAsync

Namespace
MailFathom.Application.Mail.Mutations
Assembly
MailFathom.Application.dll

OpenForWritingAsync(MailAccountId, MailFolderResolution, MailTransportSecurityPolicy, CancellationToken)

Selects a folder for writing so a mutation can be issued against the emails in it.

Task<IMailboxWriteSession> OpenForWritingAsync(MailAccountId accountId, MailFolderResolution folder, MailTransportSecurityPolicy transportSecurityPolicy, CancellationToken cancellationToken)

Parameters

accountId MailAccountId

The local account identifier.

folder MailFolderResolution

The alias binding whose remote path is selected, and which scopes every occurrence the session accepts.

transportSecurityPolicy MailTransportSecurityPolicy

The connection and authentication policy the implementation must obey.

cancellationToken CancellationToken

Cancels waiting for the account's write connection, connecting, authenticating, and selecting the folder.

Returns

Task<IMailboxWriteSession>

An open write 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. The session receives the whole binding rather than a path for the same reason the read session does: an occurrence identity is scoped by the generation the binding carries.

Exceptions

ArgumentNullException

Thrown when folder or transportSecurityPolicy is null.

MailboxUnavailableException

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