To change the IMAP folder you simple use the Select
method:
using (Imap imap = new Imap())
{
imap.ConnectSSL("imap.example.com");
imap.UseBestLogin("user", "password");
imap.Select("Sent items");
List<long> uids = imap.GetAll();
imap.Close();
}
To use inbox SelectInbox
can be used.
You can use GetFolders
to list all folders and CommonFolders
class to recognize standard folder (even when they are localized):
List<FolderInfo> folders = imap.GetFolders();
CommonFolders common = new CommonFolders(folders);
string inboxName = common.Inbox.Name;
string sentName = common.Sent.Name;
string spamName = common.Spam.Name;
// You can now select those e.g.:
imap.Select(common.Sent);