Table of Contents

Interface IMailboxWriteSessionFactory

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

Opens the one session in MailFathom able to change a remote mailbox.

public interface IMailboxWriteSessionFactory

Remarks

It is a separate factory from IMailboxSessionFactory rather than a second method on it, because the separation is what the guarantee rests on: a component that never takes this dependency cannot obtain a session that writes, whatever a later change does inside it.

An account holds at most one write connection. It is opened the first time a session is asked for, kept while it is idle for a bounded period rather than closed after each mutation, and closed when that period elapses, so a run of mutations costs one handshake instead of one per change and an account nobody is changing holds no connection at all. A second session for the same account waits for the first to be disposed.

Methods

OpenForWritingAsync(MailAccountId, MailFolderResolution, MailTransportSecurityPolicy, CancellationToken)

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