Click or drag to resize
MimeKit

MimeParserParseMessage Method

Parse a message from the stream.

Namespace: MimeKit
Assembly: MimeKit (in MimeKit.dll) Version: 4.7.1
Syntax
C#
public MimeMessage ParseMessage(
	CancellationToken cancellationToken = default
)

Parameters

cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

MimeMessage
The parsed message.

Implements

IMimeParserParseMessage(CancellationToken)
Exceptions
ExceptionCondition
OperationCanceledException The operation was canceled via the cancellation token.
FormatException There was an error parsing the message.
IOException An I/O error occurred.
Remarks
Parses a message from the stream.
Example
C#
public static MimeMessage ParseMessage (string fileName)
{
    // Load a MimeMessage from a file path or stream
    using (var stream = File.OpenRead (fileName)) {
        var parser = new MimeParser (stream, MimeFormat.Entity);

        return parser.ParseMessage ();
    }
}
See Also