Free Support Forum -

Getting " Imap server returned an invalid response" exception from ListMessages method

I have an application, that fetches emails from Gmail using Imap service. there will be more than 500 emails per day. After processing 200 or 300 emails, application will throw “Imap server returned an invalid response” exception and after that client will not pick any more. please see the code below. ALso I am using older version of aspose email (

ImapClient client = new ImapClient
client.SecurityOptions = SecurityOptions.SSLAuto;
//Generate the Query used to fetch the EMails
ImapQueryBuilder imapQueryBuilder = new ImapQueryBuilder();
MailQuery query = imapQueryBuilder.GetQuery();
//—Setting the mailbox and fetching the mails based on the query defined above
ImapMessageInfoCollection messageInfoCol = client.ListMessages(query, 100);


You are using one of very old API version on your end. I suggest you to please try using latest Aspose.Email for .NET 20.8 on your end. In case there is still an issue then please share the test account details along with snapshot of the issue incurring on your end.

Thanks @mudassir.fayyaz

Hi @mudassir.fayyaz ,

I am planning to use trial version of Aspose Email to see everything is working as expected. So functionality wise do we have any limitation for trial version


You can try using the trial version but better would be that you may obtain 30 Day free trial license to use the API with full strength on your end.

Thank you very much for the support


You are always welcome.