Free Support Forum -

IMAP not fully compatible with Gmail


I'm trying to use the IMAP APIs for access a GMail account. There's been one problem after another. I have spent approximately four hours today searching your forums, google and Aspose documetation trying to figure out how to achieve the follow.

  • Connect to Gmail account

I was able to find information on this item and am able to connect to the account.

  • Get a complete list of the folders.

I found information on this item as well; but it's incomplete. Although it shows how to get a list of folders the information does not discuss the unique aspects the [Gmail] folder and its sub folders. Nor does it discuss the fact that the count properties of the ImapFolderInformation object are not poplated until you call client.SelectFolder. Which once you do so causes a different exception because only some of the folders are seletable.

  • Foreach folder get the totatl number of messages, total new (i.e. unread) messages

Related to the item above--if you output the results of client.ListFolders() every folder shows zero for: TotalMessageCount, NewMessageCount, RecentMessageCount.

If i call client.SelectFolder, TotalMessageCount is populated with a value (unverified but populated); but NewMessageCount and RecentMessageCount are still zero. I event sent a test message to the new mail account and still the numbers were unaffected.

Any insight will be greatly appriciated.


Thank you for inquiry.

Please use the latest version of Aspose.Network for .NET 6.1, as these problems do not occur with it.

The documentation covers different scenarios and each topic has a limited scope. If we cover all aspects in single page, it would become too lengthy.

Please refer to page, as it covers majority of the operations. I have also updated this page with includes a separate ListFolder() call for getting folder status (new and total count).


I'm using Aspose.Network 6.5. I used the documentation referenced in the above link and the [GMail] folder is still not selectable. How do you get the [GMail] sub-folders without hard-coding the names of the known folders?


The [GMail] folder is not selectable, but it’s subfolders are e.g. All mail, drafts, sent mail etc. I was able to get all these sub-folders with the code in above link with the latest release. Could you please try out 6.6 and see if it works for you?

I copied the code to get the retrieve child folders inside the if-block that evaluates IsSelectable. Once I moved it out of the block I was able to get it to work with verion 6.5 of the library.

I have a follow up question. Are there any samples that show how to use the Begin/End versions of the methods?


The Begin/End methods are asynchronous. Please see the example of Ftp BeginConnect() at page. All such methods work similarly. If you face any issue with any method, please feel free to write here.