IMime ParserMbox Marker Offset Property
Get the mbox marker stream offset for the most recently parsed message.
Definition
Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
The mbox marker stream offset.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
long MboxMarkerOffset { get; }Property Value
Int64The mbox marker stream offset.
Remarks
Gets the mbox marker stream offset for the most recently parsed message.
If the IMimeParser was not initialized to parse the Mbox format or if the most recent call to ParseMessage(CancellationToken) or ParseMessageAsync(CancellationToken) was not successful, then this property will return -1.
Example
C#
public static void ParseMbox (string fileName)
{
// Load every message from a Unix mbox spool.
using (var stream = fileName.OpenRead (fileName)) {
var parser = new MimeParser (stream, MimeFormat.Mbox);
while (!parser.IsEndOfStream) {
MimeMessage message = parser.ParseMessage ();
long mboxMarkerOffset = parser.MboxMarkerOffset;
string mboxMarker = parser.MboxMarker;
Console.WriteLine ($"MBOX marker found @ {mboxMarkerOffset}: {mboxMarker}");
// TODO: Do something with the message.
}
}
}