Imap.GetMessagesAsync Method
Namespace: Rebex.Net
Assembly: Rebex.Imap.dll (version 7.0.9119)
GetMessagesAsync(ImapMessageSet, ImapListFields, Action<ImapMessage>, Object)
Begins asynchronous GetMessages operation. Downloads messages in the current folder that belong to a specified message set.
Declaration
public Task GetMessagesAsync(ImapMessageSet messageSet, ImapListFields fields, Action<ImapMessage> messageReceiver, object state = null)
Parameters
Type | Name | Description |
---|---|---|
ImapMessageSet | messageSet | A set of messages. |
ImapListFields | fields | Specifies the scope of information to determine about each message. |
Action<ImapMessage> | messageReceiver | 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. |
Object | state | An optional user-provided object that identifies this particular asynchronous operation. |
Returns
Type | Description |
---|---|
Task |
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.