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

Class MboxMessageCollection

An in-memory collection of MIME messages loaded from or destined for an MBOX file. Convenience wrapper around MboxReader and MboxWriter. For large archives, prefer the streaming reader/writer directly.

Inheritance
object
MboxMessageCollection
Implements
IEnumerable<MimeMessage>
IEnumerable
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 MboxMessageCollection : IEnumerable<MimeMessage>, IEnumerable

Constructors

View Source

MboxMessageCollection()

Initializes a new, empty instance of the MboxMessageCollection class.

Declaration
public MboxMessageCollection()

Properties

View Source

Count

Gets the number of messages in the collection.

Declaration
public int Count { get; }
Property Value
Type Description
int
View Source

this[int]

Gets the message at the specified index.

Declaration
public MimeMessage this[int index] { get; }
Parameters
Type Name Description
int index
Property Value
Type Description
MimeMessage

The message at the specified index.

Methods

View Source

Add(MimeMessage)

Adds a message to the collection. The From line is derived from the message when the collection is saved.

Declaration
public void Add(MimeMessage message)
Parameters
Type Name Description
MimeMessage message

The message to add.

View Source

Add(MimeMessage, MboxFromLine)

Adds a message to the collection with an explicit From line.

Declaration
public void Add(MimeMessage message, MboxFromLine fromLine)
Parameters
Type Name Description
MimeMessage message

The message to add.

MboxFromLine fromLine

The From line to use when writing this message.

View Source

AddRange(IEnumerable<MimeMessage>)

Adds a range of messages to the collection.

Declaration
public void AddRange(IEnumerable<MimeMessage> messages)
Parameters
Type Name Description
IEnumerable<MimeMessage> messages

The messages to add.

View Source

GetEnumerator()

Returns an enumerator that iterates through the collection.

Declaration
public IEnumerator<MimeMessage> GetEnumerator()
Returns
Type Description
IEnumerator<MimeMessage>
View Source

Load(Stream)

Loads all messages from an MBOX stream.

Declaration
public static MboxMessageCollection Load(Stream stream)
Parameters
Type Name Description
Stream stream

The stream to read from. The stream is closed by this method.

Returns
Type Description
MboxMessageCollection

A collection containing all messages in the stream.

View Source

Load(string)

Loads all messages from an MBOX file.

Declaration
public static MboxMessageCollection Load(string fileName)
Parameters
Type Name Description
string fileName

The path to the MBOX file.

Returns
Type Description
MboxMessageCollection

A collection containing all messages in the file.

View Source

Save(Stream)

Saves all messages in this collection to an MBOX stream.

Declaration
public void Save(Stream stream)
Parameters
Type Name Description
Stream stream

The stream to write to. The stream is flushed but not closed.

View Source

Save(string)

Saves all messages in this collection to an MBOX file.

Declaration
public void Save(string fileName)
Parameters
Type Name Description
string fileName

The path to the MBOX file to write.

Implements

IEnumerable<T>
IEnumerable
  • View Source
Back to top

DR-IT Software documentation

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

Generated by DocFX