Here is the modified test code. I added some of the calls we make just to be sure it was as close to the flow (without the error recovery) as possible. I can run it fine against your account, so there has to be some subtle issue in our code.
using System;
using System.Collections.Generic;
using Aspose.Email.Clients.Imap;
namespace AsposeConsoleApp1
{
class Program
{
static void Main(string[] args)
{
ImapClient ic = null;
if (args.Length > 3)
{
Int32 iPort = Int32.Parse(args[3]);
ic = new ImapClient(args[0], iPort, args[1], args[2]);
}
else
{
ic = new ImapClient(args[0], args[1], args[2]);
}
int itemsPerPage = 500;
int iPageCount = 0;
int iMessageCount = 0;
int iCurrentStartMessageNumber = 1;
try
{
ImapFolderInfo imapfi = ic.GetFolderInfo(ImapFolderInfo.InBox);
if (imapfi.TotalMessageCount > 0)
{
int iMessagesRemaining = imapfi.TotalMessageCount;
ic.SelectFolder(imapfi.Name);
List<ImapPageInfo> pages = new List<ImapPageInfo>();
Console.WriteLine("Current page: " + iPageCount +
" Current message range " + iCurrentStartMessageNumber + " to " + (iCurrentStartMessageNumber + itemsPerPage));
iPageCount++;
try
{
ImapPageInfo pageInfo = ic.ListMessagesByPage(itemsPerPage);
Console.WriteLine("Total number of messages is: " + pageInfo.TotalCount);
while (!pageInfo.LastPage)
{
bool firstmessage = true;
foreach (ImapMessageInfo page in pageInfo.Items)
{
if (firstmessage)
{
try
{
ic.FetchMessage(page.UniqueId);
iMessageCount++;
iMessagesRemaining--;
firstmessage = false;
Console.WriteLine("First message in pageinfo.items is unique id " + page.UniqueId);
}
catch (Exception e1)
{
Console.WriteLine("Fetch message failed. Last mesage count is " + iMessageCount + " Exception: " + e1.Message);
throw;
}
}
else
{
break;
}
}
try
{
pageInfo = ic.ListMessagesByPage(pageInfo.NextPage);
iCurrentStartMessageNumber = 1 + iPageCount * itemsPerPage;
Console.WriteLine("Current page: " + iPageCount +
" Current message range " + iCurrentStartMessageNumber + " to " + (iCurrentStartMessageNumber + itemsPerPage) );
iPageCount++;
}
catch (Exception e1)
{
Console.WriteLine("List Messages By Page failed. Last page count is " + iPageCount + " Exception: " + e1.Message);
throw;
}
}
}
catch (Exception e1)
{
Console.WriteLine("List Messages By Page failed. Last page count is " + iPageCount + " Exception: " + e1.Message);
throw;
}
}
}
catch (Exception e1)
{
Console.WriteLine("SelectFolder failed. Exception: " + e1.Message);
throw;
}
Console.WriteLine(" ");
Console.WriteLine("Press any key to continue.");
Console.ReadKey();
}
}
}