How to select a subfolder using imap?

0 votes
asked Jul 8, 2019 by sked1985 (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
answered Jul 8, 2019 by Lukas Pokorny (128,250 points)

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


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("", Imap.DefaultImplicitSslPort, SslMode.Implicit);
imap.Login("demo", "password");

ImapFolderCollection folders = imap.GetFolderList("", ImapFolderListMode.All, true);
foreach (ImapFolder folder in folders)
commented Jul 8, 2019 by sked1985 (180 points)
Thanks, that seems to work.