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

Free Support Forum - aspose.com

Aspose.Email.Pop3.Pop3Client.FetchMessage() never returns


We are attempting to use the Aspose.Email.Pop3.Pop3Client to fetch mail messages from a POP3 server, but at random times it appears to hang and never actually return a message. Please refer to the code below:

using (var pop3Client = new Aspose.Email.Pop3.Pop3Client())
pop3Client.Host = this.EmailAccount.IncomingMailServer;
pop3Client.Port = this.EmailAccount.IncomingMailPort.HasValue ? this.EmailAccount.IncomingMailPort.Value : 110;
pop3Client.EnableSsl = this.EmailAccount.IncomingMailSSLEnabled;
pop3Client.Username = this.EmailAccount.Username;
pop3Client.Password = this.EmailAccount.Password;

if (this.DebugMode) EventLogger.LogInformation(string.Format(“Connecting to inbox for {0}”, this.EmailAccount.EmailAddress), EmailChecker.LOG_NAME, EmailChecker.LOG_SOURCE_NAME);

if (this.DebugMode) EventLogger.LogInformation(string.Format(“Retrieving new messages for {0}”, this.EmailAccount.EmailAddress), EmailChecker.LOG_NAME, EmailChecker.LOG_SOURCE_NAME);
var messages = pop3Client.ListMessages();
foreach (var message in messages)
using (var msg = pop3Client.FetchMessage(message.SequenceNumber))

The part where it gets stuck is at var msg = pop3Client.FetchMessage(message.SequenceNumber).

If I were to set the Timeout property on the pop3Client, would that cause an error to be thrown once the timeout is exceeded? I can’t find any indication of that in the documentation. Shouldn’t there be a default timeout?

Hi Andrew,

Thank you for using Aspose.Email.

If the situation is random, there might be certain messages that be giving rise to this issue. Could you please investigate a little more and share with us if the hanging state always occurs for some specific email messages or its random? If so, we’ll be in need of those email messages for our investigation and rectification of this issue. Moreover, the Pop3 Activity Logging may be helpful to you in this regard.

With respect to the Timeout property, the application will raise an exception if the mail is not fetched within the specified timeout. The default is set to a maximum but you can set it yourself to avoid hanging situation by getting an exception. Please note that the unit of Timeout property is Milliseconds (ms).

If the issue still persists, please feel free to write to us for further assistance.

It appears to be random- and I’ve attempted to recreate it using the same mail message on our own local server, but it doesn’t get stuck. I’m afraid I cannot send you the message due to confidentiality agreements.

I will look into using Pop3 Activity Logging and also setting the Timeout property. Thank you for your help.

Hi Andrew,

Can you please share the approximate number of messages in the email account that you are retrieving? I have testes this scenario at my end but was unable to reproduce it at my end using the latest version of Aspose.Email for .NET 4.6.0. If it is possible for you to provide us with a test account credentials that we can use to reproduce this issue at our end, it will help us investigate the issue at our end and assist you further.

There were about 150 messages total, I attempted to recreate it with 300 messages and did not have any kind of problem. I’m afraid I can’t give you any credentials, and the issue isn’t actually occurring at this time. Thank you anyway!

Hi Andrew,

Thank you for the additional information. Please let us know if we can be of any additional help to you in this regard.


Has there been any fixes to this?
We are also experiencing the same issue, in our case we are using EWSClient.

We are using Aspose.Email Version


Jerson Maglasang

Hi Jerson,

We are not able to reproduce any such issue at our end with the latest version of the API i.e. Aspose.Email for .NET 16.11.0. Previously, we were not able to reproduce the problem with Pop3Client API as well. Please try with the latest version of the API and if the issue still persists, please share a test account credentials (you can create a test account on Office 365 free of cost) with us for further investigation at our end. We’ll look into it for assisting you further.