Method RenderAsync
- Namespace
- MailFathom.Application.EmailContent.Rendering
- Assembly
- MailFathom.Application.dll
RenderAsync(StoredEmailContent, EmailContentRenderingBounds, CancellationToken)
Renders one stored message.
Task<EmailContentRenderingResult> RenderAsync(StoredEmailContent content, EmailContentRenderingBounds bounds, CancellationToken cancellationToken)
Parameters
contentStoredEmailContentThe stored raw MIME.
boundsEmailContentRenderingBoundsWhat to produce, and how many characters of it a reader may be handed.
cancellationTokenCancellationTokenCancels the parse.
Returns
- Task<EmailContentRenderingResult>
The rendering, or the fact that the bytes yielded nothing a reader could be shown.
Remarks
The HTML representation costs a sanitization pass over untrusted markup, so it is produced only when it was asked for. A message with no HTML body part returns none of it whether or not it was asked for, which is what keeps "the caller did not want HTML" and "this message has no HTML" from being reported as the same thing.
An implementation applies both bounds and reports which one cut each representation. The plain text is bounded before the markup, because the caller's default representation must not be the one a shared budget starves.
Exceptions
- ArgumentNullException
Thrown when either argument is null.