We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error while reading mails from Outlook using Aspose.Email.dll

I’m using Aspose.Email.dll with version 4.1.0.0 to read mails from Outlook. Everything was working fine 3,4 months back. But now while trying to fetch mails from mailbox an error “The underlying connection was closed: An unexpected error occurred on a receive.” is showing. But when the same exe is copied to remote server its working.

Please suggest a solution.

Hi Anish,


Thank you for posting your inquiry.

You are using an older version of the API for which we shall not be able to provide support even if we are able to reproduce the issue at our end. Please download the latest version of the API i.e. Aspose.Email for .NET 6.1.0 and if you feel similar problem, please share your feedback with us along with your sample code. We shall look into this and assist you further.

Hi Muhammad,





Than you for your response.





I downloaded and add the dll, but then also the same issue is there.



Following is the code used to fetch emails from Inbox





Aspose.Email.Exchange.ExchangeClient client=new ExchangeClient(pExchangeServerUri, pExchangeUser, password,pDomain);



ExchangeMessageInfoCollection msgCollection=client.ListMessages(client.GetMailboxInfo().InboxUri, pMaxNoOfEmailsToGet);





It is here when trying to get the mail the error “the underlying connection was closed…” raising

Hi Anish,

If the same Exe works on the server, then it doesn’t
seem to be an issue with the API. The issue may be with the underlying
server connection that is refusing the connection due to an expired or
invalid certification. Please try ignoring the certificate and let us know your feedback. I hope this will solve your issue.

Hi Waqas,









I tried the steps to ignore the certificate, then also showing the same issue.

Hi Anish,


This error message appears if the Exchange Server has a self signed SSL certificate or it is expired. The suggested method should have worked for you. It may also arise if there are no “Default Accepted Domain” set in exchange configuration. Please check with your system administrator about these causes. If the issue still persists, I request you to please create a test account on your Exchange server and share its credentials with us for our further investigation. Please also share the version of Exchange server you are using at your end and any service packs installed.