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