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
accountIdMailAccountIdThe local account identifier.
folderMailFolderResolutionThe alias binding whose remote path is selected, and which scopes every occurrence the session accepts.
transportSecurityPolicyMailTransportSecurityPolicyThe connection and authentication policy the implementation must obey.
cancellationTokenCancellationTokenCancels 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
folderortransportSecurityPolicyis null.- MailboxUnavailableException
Thrown when the mail server did not accept the session within its configured resilience budget.