Free Support Forum - aspose.com

ListMessages() agains IMAP server always return 0

My code
ImapClient imapSource = new ImapClient();
imapSource.Port = 993;
imapSource.Host = xxxx;
imapSource.Username = xxx;
imapSource.Password = xxx
ImapFolderInfoCollection folderInfoColl = imapSource.ListFolders();
foreach (ImapFolderInfo folderInfo in folderInfoColl)
{
ImapFolderInfo folderInfoStatus = imapSource.GetFolderInfo(folderInfo.Name);
Console.WriteLine("Total Messages: " + folderInfoStatus.TotalMessageCount);
imapSource.SelectFolder(folderInfo.Name);
ImapMessageInfoCollection msgInfoColl = imapSource.ListMessages(false);
Console.WriteLine("Total Messages: " + msgsColl.Count);
}

The first information “folderInfoStatus.TotalMessageCount” return the correct number of messages, but the second information “msgsColl.Count” is always 0 (also if I try for another folder)
I try against OBM server (https://www.obm.org)
If I try against gmail, I haven’t this kind of problem

What is the problem ? How can I solve it ?

Regards
Gilles

@GillesTT

We are unable to reproduce this issue so can you please provide sample account on OBM server for further investigation?

Here is my code

    static bool RemoteCertificateValidationHandler(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
    {
        return true; //ignore the checks and go ahead
    }

    static ImapClient GetSslClient()
    {
      

        ImapClient imap = new ImapClient(
        "imap.teyssieux.fr",
        993,
        @"testgte.exchange",
        "Password78!",
        new RemoteCertificateValidationCallback(RemoteCertificateValidationHandler)
        );
        return imap;
    }

            ImapClient imapSource = GetSslClient();
            imapSource.SelectFolder(ImapFolderInfo.InBox);

            
            IImapMessageInfoCollection messageInfoColl = imapSource.ListMessages();
            int nbmessage1 = messageInfoColl.Count;
            ImapFolderInfoCollection folderInfoColl = imapSource.ListFolders();
            int nbfolder1 = folderInfoColl.Count;

            messageInfoColl = imapSource.ListMessages("Inbox");
            int nbmessage2 = messageInfoColl.Count;
            folderInfoColl = imapSource.ListFolders("Inbox");
            int nbfolder2 = folderInfoColl.Count;

            imapSource.Dispose();

In Inbox folder, there is one message
I expected to get following informartion
nbmessage1 = 1
nbfolder1 = 7
nbmessage1 = 1
nbfolder1 = 7

I retrieved
nbmessage1 = 0
nbfolder1 = 1
nbmessage1 = 0
nbfolder1 = 7

Two problems
Why don’t I get messages ?
Why the first call of ListFolders retrieve only one folder (inbox) and not sub folder of inbox ?

Thank you for your support, I wait to resolve this problem before purchasing your product

Regards
Gilles

@GillesTT

We try to run your code and we were able to reproduce the issue so we have logged this issue under ID “EMAILNET-39130” for further investigation. You will automatically be informed here once we have more information to share.

Moreover, please make sure you have few messages available in your inbox.

Hello

Do you have news about this problem ?
I have just purchase your product with paid support. Do I need to open a new ticket to paid support ?
I need a quick solve of this problem

Regards
Gilles

@GillesTT

We are working on this issue and we shall be able to provide hotfix release for this solution in next week.
We really appreciate for your patience.

@GillesTT

The issue has been resolved and we have prepared a hotfix release for you, please find the DLL at this link:
https://www.dropbox.com/s/jjnc7yu2uykin0l/Aspose.Email.dll?dl=0

The issues you have found earlier (filed as EMAILNET-39130) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan