0 votes
by (180 points)

I want to select a sub folder using IMAP. Is there a way of doing this? I want to select "inbox\folder_to_select".

1 Answer

+2 votes
by (148k points)

IMAP protocol does not have a standard hierarchy delimiter, but most servers use slashes instead of backslashes. So please try this first:

imap.SelectFolder("inbox/folder_to_select");

If it still doesn't work, try listing the server's folder hierarchy to determine names suitable for the SelectFolder method:

var imap = new Imap();
imap.Connect("test.rebex.net", Imap.DefaultImplicitSslPort, SslMode.Implicit);
imap.Login("demo", "password");

ImapFolderCollection folders = imap.GetFolderList("", ImapFolderListMode.All, true);
foreach (ImapFolder folder in folders)
{
    Console.WriteLine(folder.Name);
}
by (180 points)
Thanks, that seems to work.
...