IMAP GetFolderList() Folder not found.

0 votes
asked Mar 24 by ddol (240 points)

Hi,

We are experiencing some strange behaviour with an email server, we have the same code always and usually it works, but we have one server that is giving us an error when trying to launch this command:

Rebex.Net.ImapFolderCollection folderList = client.GetFolderList(mailbox.Name);

Where Mailbox.Name is "Inbox" (the rest of mailboxes works this one is the only one that fails)

When we launch that command it returns :

Rebex.Net.ImapException: Folder not found.

en Rebex.Net.Imap.adzt(String fm, ImapFolderListMode fn, Boolean fo)

We enabled the logging tools and gives this trace:

    2020-03-23 18:55:05.562 Opening log file.
2020-03-23 18:55:05.565 INFO FileLogWriter(1)[11] Info: Assembly: Rebex.Common 2018 R3 for .NET 4.0-4.7
2020-03-23 18:55:05.568 INFO FileLogWriter(1)[11] Info: Platform: Windows 10.0.17134 32-bit; CLR: 4.0.30319.42000
2020-03-23 18:55:05.569 DEBUG FileLogWriter(1)[11] Info: Culture: es; Windows-1252
2020-03-23 18:55:05.573 DEBUG Imap(1)[11] Info: State changed from 'Ready' to 'Sending'.
2020-03-23 18:55:05.573 INFO Imap(1)[11] Command: R00004 LIST "" Inbox
2020-03-23 18:55:05.573 DEBUG Imap(1)[11] Info: State changed from 'Sending' to 'Reading'.
2020-03-23 18:55:05.589 INFO Imap(1)[11] Response: R00004 OK Completed (0.000 secs)
2020-03-23 18:55:05.589 DEBUG Imap(1)[11] Info: State changed from 'Reading' to 'Ready'.
2020-03-23 18:55:05.646 ERROR Imap(1)[11] Info: Rebex.Net.ImapException: Folder not found.
   en Rebex.Net.Imap.adzt(String fm, ImapFolderListMode fn, Boolean fo)
2020-03-23 18:55:05.670 DEBUG Imap(1)[11] Info: State changed from 'Ready' to 'Sending'.
2020-03-23 18:55:05.670 INFO Imap(1)[11] Command: R00005 LIST "" Drafts
2020-03-23 18:55:05.670 DEBUG Imap(1)[11] Info: State changed from 'Sending' to 'Reading'.
2020-03-23 18:55:05.692 INFO Imap(1)[11] Response: * LIST (\HasNoChildren \Drafts) "/" Drafts
2020-03-23 18:55:05.692 INFO Imap(1)[11] Response: R00005 OK Completed (0.000 secs 1 calls)
2020-03-23 18:55:05.692 DEBUG Imap(1)[11] Info: State changed from 'Reading' to 'Ready'.
2020-03-23 18:55:05.693 DEBUG Imap(1)[11] Info: State changed from 'Ready' to 'Sending'.
2020-03-23 18:55:05.693 INFO Imap(1)[11] Command: R00006 LIST "" "Drafts/%"
2020-03-23 18:55:05.693 DEBUG Imap(1)[11] Info: State changed from 'Sending' to 'Reading'.
2020-03-23 18:55:05.710 INFO Imap(1)[11] Response: R00006 OK Completed (0.000 secs)
2020-03-23 18:55:05.710 DEBUG Imap(1)[11] Info: State changed from 'Reading' to 'Ready'.
2020-03-23 18:55:05.711 DEBUG Imap(1)[11] Info: State changed from 'Ready' to 'Sending'.
2020-03-23 18:55:05.711 INFO Imap(1)[11] Command: R00007 LIST "" Junk
2020-03-23 18:55:05.711 DEBUG Imap(1)[11] Info: State changed from 'Sending' to 'Reading'.
2020-03-23 18:55:05.726 INFO Imap(1)[11] Response: * LIST (\HasNoChildren \Junk) "/" Junk
2020-03-23 18:55:05.727 INFO Imap(1)[11] Response: R00007 OK Completed (0.000 secs 1 calls)
2020-03-23 18:55:05.727 DEBUG Imap(1)[11] Info: State changed from 'Reading' to 'Ready'.
2020-03-23 18:55:05.728 DEBUG Imap(1)[11] Info: State changed from 'Ready' to 'Sending'.
2020-03-23 18:55:05.728 INFO Imap(1)[11] Command: R00008 LIST "" "Junk/%"
2020-03-23 18:55:05.728 DEBUG Imap(1)[11] Info: State changed from 'Sending' to 'Reading'.
2020-03-23 18:55:05.744 INFO Imap(1)[11] Response: R00008 OK Completed (0.000 secs)
2020-03-23 18:55:05.744 DEBUG Imap(1)[11] Info: State changed from 'Reading' to 'Ready'.
2020-03-23 18:55:05.745 DEBUG Imap(1)[11] Info: State changed from 'Ready' to 'Sending'.
2020-03-23 18:55:05.745 INFO Imap(1)[11] Command: R00009 LIST "" Sent
2020-03-23 18:55:05.745 DEBUG Imap(1)[11] Info: State changed from 'Sending' to 'Reading'.
2020-03-23 18:55:05.760 INFO Imap(1)[11] Response: * LIST (\HasNoChildren \Sent) "/" Sent
2020-03-23 18:55:05.760 INFO Imap(1)[11] Response: R00009 OK Completed (0.000 secs 1 calls)
2020-03-23 18:55:05.760 DEBUG Imap(1)[11] Info: State changed from 'Reading' to 'Ready'.
2020-03-23 18:55:05.762 DEBUG Imap(1)[11] Info: State changed from 'Ready' to 'Sending'.
2020-03-23 18:55:05.762 INFO Imap(1)[11] Command: R0000A LIST "" "Sent/%"
2020-03-23 18:55:05.762 DEBUG Imap(1)[11] Info: State changed from 'Sending' to 'Reading'.
2020-03-23 18:55:05.781 INFO Imap(1)[11] Response: R0000A OK Completed (0.000 secs)
2020-03-23 18:55:05.781 DEBUG Imap(1)[11] Info: State changed from 'Reading' to 'Ready'.
2020-03-23 18:55:05.782 DEBUG Imap(1)[11] Info: State changed from 'Ready' to 'Sending'.
2020-03-23 18:55:05.782 INFO Imap(1)[11] Command: R0000B LIST "" Trash
2020-03-23 18:55:05.782 DEBUG Imap(1)[11] Info: State changed from 'Sending' to 'Reading'.
2020-03-23 18:55:05.797 INFO Imap(1)[11] Response: * LIST (\HasNoChildren \Trash) "/" Trash
2020-03-23 18:55:05.798 INFO Imap(1)[11] Response: R0000B OK Completed (0.000 secs 1 calls)
2020-03-23 18:55:05.798 DEBUG Imap(1)[11] Info: State changed from 'Reading' to 'Ready'.
2020-03-23 18:55:05.799 DEBUG Imap(1)[11] Info: State changed from 'Ready' to 'Sending'.
2020-03-23 18:55:05.799 INFO Imap(1)[11] Command: R0000C LIST "" "Trash/%"
2020-03-23 18:55:05.799 DEBUG Imap(1)[11] Info: State changed from 'Sending' to 'Reading'.
2020-03-23 18:55:05.814 INFO Imap(1)[11] Response: R0000C OK Completed (0.000 secs)
2020-03-23 18:55:05.814 DEBUG Imap(1)[11] Info: State changed from 'Reading' to 'Ready'.
2020-03-23 18:55:05.815 DEBUG Imap(1)[11] Info: State changed from 'Ready' to 'Disposed'.
2020-03-23 18:55:05.817 DEBUG Imap(1)[11] TLS: Closing TLS socket.
2020-03-23 18:55:05.823 INFO Imap(1)[11] TLS: Alert Alert:Alert was sent.
2020-03-23 18:55:05.823 INFO Imap(1)[11] TLS: State StateChange:Closed

There's anything we can do to fix this issue?

Thanks.

Kind regards.

Applies to: Rebex Secure Mail

1 Answer

+1 vote
answered Mar 24 by Lukas Pokorny (107,350 points)
selected Mar 24 by ddol
 
Best answer

This looks like a server-side bug.

When the GetFolderList(folderName) method is called to list the contents of the specified folder, it first issues 'LIST "" FolderName' command to list the specified folder in its root location, and determine the folder hierarchy delimiter used by the folder.

Next, once the delimiter has been determined, the method issues 'LIST "" "FolderName[DELIMITER]%" (with "[DELIMITER]" replaced by the folder delimiter used by the server - usually '/', '\' or '.').

According to the log you posted, this works fine for "Drafts", "Junk" and other folders, but the server has trouble with "Inbox", where it fails during the first step (determining the delimiter). And unfortunately, the failure is identical to one that occurs when the specified folder does not exist.

If you need to fix this, please contact the server vendor.

As a workaround, call GetFolderList("Inbox/%") on this server instead of GetFolderList("Inbox") to skip the delimiter-detection part of GetFolderList. (Make sure not to apply this on other servers which could use different folder delimiters.)

commented Mar 24 by ddol (240 points)
Hi Lukas, thanks for the fast response.

I just wanted to confirm you that the workaround that you provided worked as a charm.

I still will report this error to the email server provider.

Thanks a lot
...