Click or drag to resize
MimeKit

MimeMessageLoad(Stream, Boolean, CancellationToken) Method

Load a MimeMessage from the specified stream.

Namespace: MimeKit
Assembly: MimeKit (in MimeKit.dll) Version: 4.7.1
Syntax
C#
public static MimeMessage Load(
	Stream stream,
	bool persistent,
	CancellationToken cancellationToken = default
)

Parameters

stream  Stream
The stream.
persistent  Boolean
true if the stream is persistent; otherwise false.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

MimeMessage
The parsed message.
Exceptions
ExceptionCondition
ArgumentNullExceptionstream is null.
OperationCanceledException The operation was canceled via the cancellation token.
FormatException There was an error parsing the entity.
IOException An I/O error occurred.
Remarks

Loads a MimeMessage from the given stream, using the default ParserOptions.

If persistent is true and stream is seekable, then the MimeParser will not copy the content of MimeParts into memory. Instead, it will use a BoundStream to reference a substream of stream. This has the potential to not only save memory usage, but also improve MimeParser performance.

See Also