Imap getmessages issue

Hi Team,

I am using the following code for getting the messages from Imap

ImapClient imapclient = null;

int startindex=0;
imapclient.selectFolder(myfolder);

ImapPageInfo coll = imapclient.listMessagesByPage(100,startindex);

Now, In this folder there are total 9 messages , now when I use the following code

startindex++;
coll = imapclient.listMessagesByPage(100,startindex);

It gives me 1(one) record, I check the same even my startindex is 1 , 2 or anything

System.out.println("SIZE:- " + coll.getItems().getIList().size());

Please provide me the solution of getting messages from particular folder using Imap

Thanks and Regards,

Ajay Kumar

@ajaykumar2018

Thank you for writing to us.

For reading messages from specific folder, please use the code sample given at this link:
https://docs.aspose.com/display/emailjava/Working+with+Messages+from+IMAP+Server#WorkingwithMessagesfromIMAPServer-ListingMessageswithPagingSupport

By following the code sample at this link you can read all folders.
https://docs.aspose.com/display/emailjava/Working+with+Folders+on+IMAP+Server#WorkingwithFoldersonIMAPServer-GettingFoldersInformation

Moreover, please feel free to write back to us if you need additional information in this regard.