Mime MessageLoad(Stream, Mime Content Storage, Cancellation Token) Method
Load a MimeMessage from the specified stream.
Definition
Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
The parsed message.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public static MimeMessage Load(
Stream stream,
MimeContentStorage storage,
CancellationToken cancellationToken = default
)Parameters
- stream Stream
- The stream.
- storage MimeContentStorage
- The storage used for parsed MIME part content.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
MimeMessageThe parsed message.
Remarks
Loads a MimeMessage from the given stream, using the default ParserOptions.
Memory copies MIME part content into memory (the default). Source references content in the seekable input stream instead. The caller owns the stream in both modes. With Source, keep it open and its contents unchanged while the parsed content is in use. Disposing parsed messages or entities does not close the input stream.
Exceptions
| ArgumentOutOfRangeException | storage is not a valid value. |
| ArgumentException | storage is Source and stream is not seekable. |
| ArgumentNullException | stream is . |
| OperationCanceledException | The operation was canceled via the cancellation token. |
| FormatException | There was an error parsing the entity. |
| IOException | An I/O error occurred. |