Imap GetFolders() only returns "Inbox"

0 votes
asked Sep 26, 2011 by TestCSSL (360 points)
edited Sep 27, 2011

When I call the following code, it only returns the "Inbox", instead of the full folder list.

    var md = new MailData();
    var folders = _imap.GetFolderList("", ImapFolderListMode.All, true);
    md.MessageCount = 0;
    md.UnseenMessageCountInFolder = new Dictionary<string, int>();
    md.MessagesInFolder = new Dictionary<string, List<MailMessage>>();
    foreach (ImapFolder folder in folders)
        var list = GetMessageList(folder.Name);
        var count = GetUnseenMessageCount(folder.Name);
        md.UnseenMessageCountInFolder.Add(folder.Name, count);
        md.MessageCount += GetMessageCount(folder.Name);

Is this some bug in the code, or am I doing something wrong? A few days ago this code returned all folders, and suddenly it only returned the "Inbox". In the meanwhile I didn't change anything in the code where I call that function.

Sidenote: MailData is a custom class for storing the recieved data.

I don't know which part of the log is relevant to you, so here is the log from when the function above was called:

The log ain't correct: it picks the other webservice(the one for POP).

Note: I was using as login server

Applies to: Rebex Secure Mail

2 Answers

0 votes
answered Sep 26, 2011 by Lukas Pokorny (128,250 points)
edited Sep 26, 2011
Best answer

There doesn't appear to be anything wrong with your code. It looks like something was changed at the server in the meantime.

To see the actual communication between the client and the server, including the list of folders as sent by he server, create a communication log using Imap object's LogWriter property and add the relevant part to your post (or mail it to We might be able to spot something.

commented Sep 26, 2011 by TestCSSL (360 points)
edited Sep 26, 2011

Thank you for the help, I will check it out

0 votes
answered Sep 27, 2011 by TestCSSL (360 points)
edited Sep 27, 2011

Problem solved :)

I was using data from a settings file, and that one logged in to a POP server.
That is why it went wrong and I only got the Inbox folder.

Thanks anyway