Method AppendRestoredAsync
- Namespace
- MailFathom.Application.Mail.Mutations
- Assembly
- MailFathom.Application.dll
AppendRestoredAsync(ReadOnlyMemory<byte>, RestoredEmailState, DateTimeOffset, CancellationToken)
Puts a held message back into this session's folder when the account's custody returns to mirroring.
Task<RemoteEmailPlacement> AppendRestoredAsync(ReadOnlyMemory<byte> rawMime, RestoredEmailState state, DateTimeOffset internalDate, CancellationToken cancellationToken)
Parameters
rawMimeReadOnlyMemory<byte>The stored RFC 822 bytes to append, which are the bytes the source delivered when it was first stored.
stateRestoredEmailStateThe flags and keywords MailFathom holds for the message, which the copy carries onto the source.
internalDateDateTimeOffsetThe arrival the stored message recorded, so a restored folder sorts as it did before.
cancellationTokenCancellationTokenCancels the append.
Returns
- Task<RemoteEmailPlacement>
Where the folder put the copy, when the server named it.
Remarks
The fifth reopening of this surface, and the one act here that puts a message somebody else sent back where it
came from. It is a method of its own rather than a mode of AppendAsync(ReadOnlyMemory<byte>, AppendedMailFlags, DateTimeOffset, CancellationToken) because the two assert
different things: that one appends a copy MailFathom composed, carrying the two flags a composition establishes,
while this one appends mail MailFathom was holding and carries what the source last showed about it together
with what a person did to it while it was held. So this operation carries four system flags — \Seen,
\Answered, \Flagged and \Draft — and the keywords beside them, each of which MailFathom
observed per message and would otherwise lose on the way back. \Deleted is the one it does not carry,
because it is a request that the folder stop holding the message rather than an observation about it.
It is never repeated on the caller's behalf, for the reason AppendAsync(ReadOnlyMemory<byte>, AppendedMailFlags, DateTimeOffset, CancellationToken) is not: an APPEND
issued twice is a second message in the user's folder. The durable record the restore writes before calling is
what a resumed attempt reads, and a record whose answer never arrived is reported to an operator rather than
issued again. See
ADR 0034.
Exceptions
- ArgumentException
Thrown when
rawMimeis empty.- ArgumentNullException
Thrown when
stateis null.- 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.