Hello,
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);
pop3Client.Connect();
pop3Client.Login();
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))
{
ParseMessage(msg);
}
pop3Client.DeleteMessage(message.SequenceNumber);
}
pop3Client.CommitDeletes();
pop3Client.Quit();
pop3Client.Disconnect();
}
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,
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.
Hello,
Hi Jerson,