# EmailMailboxReader

Reads mboxo and mboxrd mailbox aggregates.

Class 

`OfficeIMO.Email`

**Namespace**

`OfficeIMO.Email`

**Assembly**

`OfficeIMO.Email`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[EmailMailboxReader.cs:8](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Mbox/EmailMailboxReader.cs#L8)

**Modifiers**

sealed

Reads mboxo and mboxrd mailbox aggregates.

## Inheritance

- object
- EmailMailboxReader

Filter members 

Show inherited

## Constructors

EmailMailboxReader 2 overloads

`public EmailMailboxReader()` [#](#constructor-ctor)

[EmailMailboxReader.cs:8](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Mbox/EmailMailboxReader.cs#L8)

Creates a reader with the default policy.

`public EmailMailboxReader(EmailMailboxReaderOptions options)` [#](#constructor-ctor-officeimo-email-emailmailboxreaderoptions)

[EmailMailboxReader.cs:11](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Mbox/EmailMailboxReader.cs#L11)

Creates a reader with an immutable policy.

Parameters

**options OfficeIMO.Email.EmailMailboxReaderOptions required**

## Methods

Read 3 overloads

`public EmailMailboxReadResult Read(string filePath, CancellationToken cancellationToken = default)` [#](#method-read-string-threading-cancellationtoken)

[EmailMailboxReader.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Mbox/EmailMailboxReader.cs#L20)

Reads a mailbox file.

Parameters

**filePath string required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`EmailMailboxReadResult`

`public EmailMailboxReadResult Read(byte[] data, CancellationToken cancellationToken = default)` [#](#method-read-byte-threading-cancellationtoken)

[EmailMailboxReader.cs:26](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Mbox/EmailMailboxReader.cs#L26)

Reads mailbox bytes.

Parameters

**data byte[] required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`EmailMailboxReadResult`

`public EmailMailboxReadResult Read(Stream stream, CancellationToken cancellationToken = default)` [#](#method-read-io-stream-threading-cancellationtoken)

[EmailMailboxReader.cs:42](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Mbox/EmailMailboxReader.cs#L42)

Reads without closing the stream. Seekable streams are read from the beginning and restored to their original position; non-seekable streams are read forward from their current position.

Parameters

**stream System.IO.Stream required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`EmailMailboxReadResult`

ReadAsync 2 overloads

`public async Task<EmailMailboxReadResult> ReadAsync(string filePath, CancellationToken cancellationToken = default)` [#](#method-readasync-string-threading-cancellationtoken)

Asynchronously reads a mailbox file.

Parameters

**filePath string required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<EmailMailboxReadResult>`

`public async Task<EmailMailboxReadResult> ReadAsync(Stream stream, CancellationToken cancellationToken = default)` [#](#method-readasync-io-stream-threading-cancellationtoken)

Asynchronously reads without closing the stream. Seekable streams are read from the beginning and restored to their original position; non-seekable streams are read forward.

Parameters

**stream System.IO.Stream required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`Task<EmailMailboxReadResult>`

ReadEntries 2 overloads

`public IEnumerable<EmailMailboxEntryReadResult> ReadEntries(string filePath, CancellationToken cancellationToken = default)` [#](#method-readentries-string-threading-cancellationtoken)

[EmailMailboxReader.cs:78](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Mbox/EmailMailboxReader.cs#L78)

Enumerates a mailbox file while retaining at most one decoded message in memory.

Parameters

**filePath string required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`IEnumerable<EmailMailboxEntryReadResult>`

`public IEnumerable<EmailMailboxEntryReadResult> ReadEntries(Stream stream, CancellationToken cancellationToken = default)` [#](#method-readentries-io-stream-threading-cancellationtoken)

[EmailMailboxReader.cs:87](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Mbox/EmailMailboxReader.cs#L87)

Enumerates a caller-owned mailbox stream while retaining at most one decoded message in memory. Seekable streams are restored to their original position when enumeration ends or is disposed.

Parameters

**stream System.IO.Stream required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`IEnumerable<EmailMailboxEntryReadResult>`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public EmailMailboxReaderOptions Options { get; }` [#](#property-options)

[EmailMailboxReader.cs:16](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.Email/Mbox/EmailMailboxReader.cs#L16)

Reader policy used by this instance.

<!-- PowerForge markdown artifact sha256:ACBE4545880EF11FD246E5ECE1170FFE9D3BA904D3017F33636665696688C27A -->
