Method ReadForScreeningAsync
- Namespace
- MailFathom.Application.Mail.Delivery.Screening
- Assembly
- MailFathom.Application.dll
ReadForScreeningAsync(ReadOnlyMemory<byte>, CancellationToken)
Reads the same words plus the text of every document the message attaches.
Task<OutgoingMailText> ReadForScreeningAsync(ReadOnlyMemory<byte> rawMime, CancellationToken cancellationToken)
Parameters
rawMimeReadOnlyMemory<byte>The RFC 822 bytes that will be stored and transmitted.
cancellationTokenCancellationTokenCancels the parse and the extraction.
Returns
- Task<OutgoingMailText>
What the message says in words, or why its attachments left nothing to judge them by.
Remarks
Separate from the read above because it costs a different order of work: it opens each attachment and offers it to IAttachmentTextExtractor, so a message of large documents runs document parsers on whatever thread the caller is holding. Only a caller that will judge what comes back asks for it, and a caller that only wants the words asks for the read above instead.
An attachment nothing here recognizes as a document contributes nothing and refuses nothing, because no text scanner ever undertook to read one. Everything else that yields no text is a refusal, since an attachment that was not read must never be treated as clean.
Exceptions
- ArgumentException
Thrown when
rawMimeis empty.- OperationCanceledException
Thrown when
cancellationTokenis cancelled.