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

Free Support Forum - aspose.com

Pop3 Disconnect()

I retrieve a mail message with a Pop3 protocol and after call the disconnect method. The disconnect method throw an System.FormatException with this message “Smtp server returned an invalid response.”. The connection is to an gmail account.

luis gomes

code example:

if (mailClient.GetMessageCount() > 0) //the count is >0
Pop3MessageInfoCollection list = mailClient.ListMessages();

foreach (Pop3MessageInfo msg in list)
simpleMsgTemp = new SimpleMessage(msg);
//validates if message satisfies the conditions in the validator
if (MyValidator.ExecuteHeader(simpleMsgTemp))
msgTemp = mailClient.FetchMessage(msg.SequenceNumber);

mailMessage = new AmbisigMailMessage(msgTemp);
//if so adds to list
if (MyValidator.Execute(mailMessage))
mailClient.Disconnect(); //call throwing an exception

stack trace:
System.FormatException: Smtp server returned an invalid response.
at Aspose.Network.Pop3.xc0113876a6178336.x428af81c052664cd(Byte[] x5cafa8d49ea71ea1, Int32 x374ea4fe62468d0f, Int32 x5586b6ed3aa176aa, Boolean x2a61df92f136d15f)
at Aspose.Network.Pop3.xc0113876a6178336.x57b93d62121e7a3c(x797e8d0c84c1dd5e xceac2b54ad924cdf, Boolean x892516b850cc2461, String x35a507a8c5f24ce2)
at Aspose.Network.Pop3.xc0113876a6178336.xa8adf7fbd1cf75d9(x797e8d0c84c1dd5e xceac2b54ad924cdf)
at Aspose.Network.Pop3.x797e8d0c84c1dd5e.xa8adf7fbd1cf75d9()
at Aspose.Network.Pop3.xc8a1d7db7ff34f86.x2de48dbd5ff873e9(xa4caae318ec80e48 x79ee3f6bdf75f984, String xffe521cc76054baf)
at Aspose.Network.Pop3.xa9ecb94214a7b943.x2de48dbd5ff873e9(xa4caae318ec80e48 x79ee3f6bdf75f984, String x1f25abf5fb75e795)
at Aspose.Network.Pop3.xa9ecb94214a7b943.x2de48dbd5ff873e9(xa4caae318ec80e48 x79ee3f6bdf75f984)
at Aspose.Network.Pop3.x273b0563d5729a6f.xd76be4f8ca318724()
at Aspose.Network.Pop3.Pop3Client.Disconnect()
at Ambisig.Utilities.Network.POPClient.ListWantedMessages(Validator MyValidator)

Hi Luis,

Does it happens frequently or every time you connect, check messages and call Disconnect() method?

Hi Saqib,

The problem only occurs when I check the messages. If no messages exists in the mailbox it works fine (the disconnect don’t throw an exception).

Luis gomes

Hi Luis,

Could you please download and try the latest release of Aspose.Network for .NET v5.0 and test if it resolves this issue.