IMAPClient failing listmessages at about 3k messages version 17.6.0.0

For some reason, I cannot get past 3000 messages in an imap client folder. I have followed all instructions on this forum.

My code

Dim client As New ImapClient()
client.SecurityOptions = Clients.SecurityOptions.SSLImplicit

    client.Port = 993
    client.Host = "host.somesite.com"
    client.Username = "user"
    client.Password = "eeee"
  

    For Each ifo As ImapFolderInfo In client.ListFolders()
        client.SelectFolder(ifo.Name)
        Dim pages As New List(Of ImapPageInfo)
        Dim pageInfo As ImapPageInfo = client.ListMessagesByPage(500)
        pages.Add(pageInfo)

        While Not pageInfo.LastPage
            pageInfo = client.ListMessagesByPage(pageInfo.NextPage)
            pages.Add(pageInfo)
        End While

        For Each p As ImapPageInfo In pages
            Dim list As ImapMessageInfoCollection = p.Items
            For i As Integer = 1 To list.Count
                ' Save the EML file locally
                If Directory.Exists(mainfolder & ifo.Name) = False Then Directory.CreateDirectory(mainfolder & ifo.Name)
                client.SaveMessage(list(i - 1).UniqueId, mainfolder & ifo.Name & "\" & (p.PageOffset + list(i - 1).UniqueId) & ".eml")
            Next
        Next
        Try
           
        Catch ex As Exception

        End Try
       
        If ifo.HasChildren = True Then
            getchildfolder(client, ifo.Name, mainfolder & "\" & ifo.Name & "\")
        End If
    Next

@rakesh_bhatt,

We couldn’t reproduce the issue at our end using the latest version of the API at our end i.e. Aspose.Email for .NET 17.10. Could you please share with us which email server are you connecting to and if you are using this latest version at your end?

it is a linux cpanel server. I have client credentials so cannot provide. here is the error being generated.

“Value does not fall within the expected range.”

Also happens with version 17.10

happens close to item 3k or so. Although if I sync it with a mail client like outlook, it works fine.

Rakesh

When running g searches I find that this is probably a bug in the sense if there is an object being returned that is a duplicate of another object, when adding to a list, it errors out. Not sure how aspose is handling it, but the listmessages is giving this error.

rb

@rakesh_bhatt,

We need a little help from you in this regard since we are not able to reproduce the problem at our end. Can you please try the same with a public email server such as Gmail and check if the issue occurs? If so, you can share the test account credentials with us for further investigation at our end.

It does work OK with google and other imap accounts. Just not this one. I guess I will consider this a one off issue and close ticket.

Thanks for the help

Thank you for sharing your feedback.