MimeEntityLoad(ParserOptions, Stream, MimeContentStorage, CancellationToken) Method

Load a MimeEntity from the specified stream.

Definition

Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public static MimeEntity Load(
	ParserOptions options,
	Stream stream,
	MimeContentStorage storage,
	CancellationToken cancellationToken = default
)

Parameters

options  ParserOptions
The parser options.
stream  Stream
The stream.
storage  MimeContentStorage
The storage used for parsed MIME part content.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

MimeEntity
The parsed MIME entity.

Remarks

Loads a MimeEntity from the given stream, using the specified 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

options is .

-or-

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.

See Also