MboxStorageReader

MboxStorageReader class

Represents an MBOX file and provides methods for reading and extracting messages. The MBOX file format is used for storing a collection of email messages.

The following code provided is intended for processing email messages stored in an MBOX file using the MboxStorageReader class.

// Create an instance of the MboxStorageReader using the factory method 'CreateReader'.
var mbox = MboxStorageReader.CreateReader("storage.mbox", new MboxLoadOptions());
 
// Iterate through each message info object in the mbox storage.
foreach (var mboxMessageInfo in mbox.EnumerateMessageInfo())
{
    Console.WriteLine($"Subject: {mboxMessageInfo.Subject}");
    Console.WriteLine($"From: {mboxMessageInfo.From}");
    Console.WriteLine($"To: {mboxMessageInfo.To}");
 
 // Extract the full MIME message object from the MBOX storage using the message's unique entry ID.
    var eml = mbox.ExtractMessage(mboxMessageInfo.EntryId, new EmlLoadOptions());
 
 // Save the extracted MIME message as an .eml file.
    eml.Save($"{eml.Subject}.eml");
}
' Create an instance of the MboxStorageReader using the factory method 'CreateReader'.
Dim mbox As MboxStorageReader = MboxStorageReader.CreateReader("storage.mbox", New MboxLoadOptions())
 
' Iterate through each message info object in the mbox storage.
For Each mboxMessageInfo As var In mbox.EnumerateMessageInfo()
    Console.WriteLine($"Subject: {mboxMessageInfo.Subject}")
    Console.WriteLine($"From: {mboxMessageInfo.From}")
    Console.WriteLine($"To: {mboxMessageInfo.To}")
 
 ' Extract the full MIME message object from the MBOX storage using the message's unique entry ID.
    Dim eml As var = mbox.ExtractMessage(mboxMessageInfo.EntryId, New EmlLoadOptions())
 
 ' Save the extracted MIME message as an .eml file.
    eml.Save($"{eml.Subject}.eml")
Next

Constructors

NameDescription
MboxStorageReader (2 overloads)Initializes a new instance of the MboxStorageReader class.

Methods

NameDescription
ByteArrayStartsFromMarkerChecks whether the array starts from given marker.
CancelThis method used to interrupt a split operation.
ContainsAsctimeDetermines whether the specified line contains asctime string.
CreateReader (2 overloads)Creates the instance of reader.
Dispose (2 overloads)Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
EnumerateMessageInfo (3 overloads)Exposes the enumerator, which supports an iteration of messages in storage.
EnumerateMessages (6 overloads)Exposes the enumerator, which supports an iteration of messages in storage.
ExtractMessageGet the message from MBOX.
get_BaseStreamGets the base stream.
get_CurrentDataSizeGets the number of bytes that is read by ReadNextMessage method.
GetTotalItemsCountReturns the number of messages in a storage.
GetVentureLicenseState
NextMessage (2 overloads)Gets the next message info.
ReadLineReads the line from stream.
ReadNextMessage (5 overloads)Reads the next message from underlying storage stream.
set_CurrentDataSizeGets the number of bytes that is read by ReadNextMessage method.
SetPositionByIndexImplemented in Aspose::Email::Storage::Mbox::MboxrdStorageReader , and Aspose::Email::Storage::Mbox::MboxoStorageReader .
SplitInto (2 overloads)Splits the mbox storage into less sized parts.
MboxoStorageReader
MboxrdStorageReader
EmlCopiedEvent that occurs after successful copy of a MailMessage object within the SplitInto(long, string) method.
EmlCopyingEvent that occurs before the MailMessage object copy process, within the SplitInto(long, string) method.
EmptyFromMarkerCR
EmptyFromMarkerCRLF
EmptyFromMarkerLF
FromMarker“From " signature, indicates a start of the message.
MboxFileCreatedEvent that occurs when a new MBOX file is created during the SplitInto(long, string) method.
MboxFileFilledEvent that occurs after filling an MBOX file with data within the SplitInto(long, string) method.
MboxoMarkerThe mbox format uses a single blank line followed by the string ‘From ’ (with a space) to delimit messages. In mboxo format sender’s email address in message delimiter is replaced by the constant string ‘???@???’, i.e. ‘From ???@???’
msgCount
mVentureLicense
preferredTextEncoding