The .FolderExists(folderName) function returns false but SelectFolder works properly

0 votes
asked May 14, 2018 by mtaber (220 points)

I'm logging into a mailbox hosted at and prior to selecting a folder, I verify it exists using imapClient.FolderExists(folderName). This works for all folders in the mailbox with the exception of the Inbox.

When I simply call .SelectFolder(folderName) it functions correctly. However the intent is to intercept potential errors with cached names in our database by verifying the folder exists before attempting to select it.

The other folders on the mail server appear to be running the FolderExists function properly but for whatever reason, the Inbox is treated as if it doesn't exist. Any ideas why the Inbox would be treated differently by this function or by their servers?

I think my workaround is going to be to test the server name and folder name for that combination and if it matches, just skip the FolderExists function. However I hate to have to include special-case logic for specific hostnames.

Any ideas would be appreciated.

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered May 15, 2018 by Lukas Matyska (59,530 points)

It seems to be a bug in this specific mail server.

Can you please post here communication log (or send it to We will analyze it to ensure there is no bug on client side for FolderExists("Inbox") case. It can be created like this:

imapClient.LogWriter = new Rebex.FileLogWriter("c:/data/imap.log", LogLevel.Debug);

Actually, the Inbox folder has to exist always (defined by IMAP protocol). So for Inbox you don't need to perform this check at all.