Method AppendAsync
- Namespace
- MailFathom.Application.Mail.Mutations
- Assembly
- MailFathom.Application.dll
AppendAsync(ReadOnlyMemory<byte>, AppendedMailFlags, DateTimeOffset, CancellationToken)
Puts a copy of a message MailFathom composed into this session's folder.
Task<AppendedMailCopy> AppendAsync(ReadOnlyMemory<byte> rawMime, AppendedMailFlags flags, DateTimeOffset internalDate, CancellationToken cancellationToken)
Parameters
rawMimeReadOnlyMemory<byte>The stored RFC 822 bytes to append, which are the bytes that were or will be transmitted.
flagsAppendedMailFlagsThe flags the appended copy carries, which the message's own state decides.
internalDateDateTimeOffsetThe internal date the server records for the copy, which is what a mail client sorts the folder by.
cancellationTokenCancellationTokenCancels the append.
Returns
- Task<AppendedMailCopy>
What the server said about the copy it accepted.
Remarks
This is the one operation here that creates a message rather than changing one, and the one that takes no
occurrence — an APPEND names a folder and a body, so there is no message of the owner's it could reach.
The folder is this session's own selection rather than an argument, which is what keeps a caller from appending
into a folder it did not open the session for.
It is never repeated on the caller's behalf, for the reason a copy is not: an APPEND issued twice is a
second message in the owner's folder rather than a repeat of the first, and nothing the folder shows afterwards
tells them apart. There is no journal here because the durable record of the append is the caller's outgoing
record, which is written before this is called and confirmed after it returns.
The bytes are appended as they were stored rather than recomposed, so the filed copy is the message that was delivered. Nothing about this reads or writes any other message's flags.
Exceptions
- ArgumentException
Thrown when
rawMimeis empty.- MailboxUnavailableException
Thrown when the mail server did not serve the append within its configured resilience budget.
- MailboxFolderRecreatedException
Thrown when a recovered connection reselected the folder with a different UIDVALIDITY.