Searching and downloading messages
ImapX allows you to request messages in various different ways.Accessing messages through Folder.Messages
By default, the Messages collection of a Folder will be empty. To download messages, make a call to the Download method:/* .. Init client, authenticate .. *//* .. folder = any folder .. */ folder.Messages.Download(/* optional, add filter, change download mode, limit number of messages */)
If you don't want to call the Download method on every folder, you can simply set the client behavior to automatically populate the Folder.Messages collection:
/* .. Init client, authenticate .. */ client.Behavior.AutoPopulateFolderMessages = true;
Requesting messages through Folder.Search
You can also use the Folder.Search method to request messages. All found messages will be returned by the Search method, and will also be added to the Folder.Messages collection:/* .. Init client, authenticate .. *//* .. folder = any folder .. */var messages = folder.Search(/* optional, add filter, change download mode, limit number of messages */)