Begins asynchronous GetMessages operation. Downloads messages in the current folder that belong to a specified message set.

Namespace:  Rebex.Net
Assembly:  Rebex.Imap (in Rebex.Imap.dll)

Syntax

Visual Basic
Public Function BeginGetMessages ( _
	messageSet As ImapMessageSet, _
	fields As ImapListFields, _
	messageReceiver As Action(Of ImapMessage), _
	callback As AsyncCallback, _
	state As Object _
) As IAsyncResult
C#
public IAsyncResult BeginGetMessages(
	ImapMessageSet messageSet,
	ImapListFields fields,
	Action<ImapMessage> messageReceiver,
	AsyncCallback callback,
	Object state
)

Parameters

messageSet
Type: Rebex.Net..::..ImapMessageSet
A set of messages.
fields
Type: Rebex.Net..::..ImapListFields
Specifies the scope of information to determine about each message.
messageReceiver
Type: System..::..Action<(Of <(<'ImapMessage>)>)>
A handler to process received messages. It has to process messages (and exit) quickly. If slow/complex processing is required, hand messages over to other thread.
callback
Type: System..::..AsyncCallback
An optional asynchronous callback to be called when the operation is complete.
state
Type: System..::..Object
A user-provided object that identifies this particular asynchronous operation.

Return Value

An IAsyncResult that references the asynchronous operation.

Remarks

Uses IMAP FETCH command to retrieve messages.

By default, this method marks messages as read. To prevent this behavior, set the UsePeekForGetMessage to true.

This method demands a lot of data to be received from the server. The data has to be read from the network socket as fast as possible. This places demand on messageReceiver handler to process received messages as fast as possible. If the handler slows the process too much, incoming data will not be read from the underlying network socket in sufficient speed and TCP internal buffers will be overfilled. This can cause strange network exceptions.

In builds for .NET 4.0 and higher, this method is available as an extension method. Add 'using Rebex.Legacy' (C#) or 'Import Rebex.Legacy' (VB.NET) to your code in order to use it.

Version Information

.NET Compact Framework

Supported in: 3.9, 3.5

See Also