• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class MboxReader

Reads MBOX mailbox files (RFC 4155) from a stream, yielding one MimeMessage per stored message. Reads lazily: the underlying stream is consumed as messages are enumerated, so arbitrarily large archives can be processed without loading the whole file into memory. Not thread-safe.

Inheritance
object
MboxReader
Implements
IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: DRIT.Mail.Rfc.Mbox
Assembly: DRIT.Mail.dll
Syntax
public sealed class MboxReader : IDisposable

Constructors

View Source

MboxReader(Stream)

Initializes a new instance of the MboxReader class.

Declaration
public MboxReader(Stream stream)
Parameters
Type Name Description
Stream stream

The stream used to read or write the data.

View Source

MboxReader(Stream, bool)

Initializes a new instance of the MboxReader class.

Declaration
public MboxReader(Stream stream, bool leaveOpen)
Parameters
Type Name Description
Stream stream

The stream used to read or write the data.

bool leaveOpen

The leave open used by the operation.

Properties

View Source

CurrentFromLine

Gets the From line of the message most recently returned by ReadMessage(), or null if no message has been read.

Declaration
public MboxFromLine? CurrentFromLine { get; }
Property Value
Type Description
MboxFromLine
View Source

CurrentIndex

Gets the zero-based index of the message most recently returned by ReadMessage(), or -1 if none.

Declaration
public int CurrentIndex { get; }
Property Value
Type Description
int

Methods

View Source

Dispose()

Processes the dispose data.

Declaration
public void Dispose()
View Source

ReadAllMessages()

Enumerates all remaining messages in the stream.

Declaration
public IEnumerable<MimeMessage> ReadAllMessages()
Returns
Type Description
IEnumerable<MimeMessage>

An enumerable of all remaining messages.

View Source

ReadFromLine()

Reads the next message's From line (envelope sender + timestamp), or null at end of file. Does not advance past the message body. A subsequent call to ReadMessage() will return the message associated with this From line.

Declaration
public MboxFromLine? ReadFromLine()
Returns
Type Description
MboxFromLine
View Source

ReadMessage()

Reads the next message, or null at end of file. The returned MimeMessage does not include the From line; the From line is exposed separately via CurrentFromLine.

Declaration
public MimeMessage? ReadMessage()
Returns
Type Description
MimeMessage

Implements

IDisposable
  • View Source
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX