jstedfast / MailKit

A cross-platform .NET library for IMAP, POP3, and SMTP.
http://www.mimekit.net
MIT License
6.06k stars 811 forks source link

Pop3Client Authenticate Error #872

Closed yZuoB closed 5 years ago

yZuoB commented 5 years ago

Describe the bug When an email account has a large amount of data, 20437, it throws an exception when it logs in

MailKit.Net.Pop3.Pop3ProtocolException: "Pop3 server returned an invalid response to the STAT command."

Is it due to the number of email accounts?

Other accounts are normal, and this account was normal before.

To Reproduce Create Client var client = new Pop3Client() 1.client.Connect(pop.Server,pop.Port,SecureSocketOptions.SslOnConnect);

  1. client.Authenticate(pop.UserName,pop.Password);

Screenshots image

jstedfast commented 5 years ago

I need a protocol log to diagnose the problem. Please follow these directions: https://github.com/jstedfast/MailKit/blob/master/FAQ.md#ProtocolLog

jstedfast commented 5 years ago

Have you had any luck getting a protocol log yet? I'd love to fix this issue but can't until you can get me that info so that I can see what is going on.

jstedfast commented 5 years ago

I added some extra diagnostic info to the POP3 exceptions. If you install v2.2.0.6 from https://www.myget.org/feed/mimekit/package/nuget/MailKit then that might also help narrow down the issue.

Note: If you get me a protocol log, then it won't be necessary to install the v2.2.0.6 nuget package. The v2.2.0.6 build is only an alternative option if it would be easier to log an exception error when it fails rather than getting a protocol log.

yZuoB commented 5 years ago

The problem has not been reproduced. Sorry, the log was not saved at the time. The exception I see from the stack should be when the number of messages is updated. This account has a lot of emails. I will log the next time I reproduce it. Troubled

At 2019-06-18 19:38:15, "Jeffrey Stedfast" notifications@github.com wrote:

I added some extra diagnostic info to the POP3 exceptions. If you install v2.2.0.6 from https://www.myget.org/feed/mimekit/package/nuget/MailKit then that might also help narrow down the issue.

Note: If you get me a protocol log, then it won't be necessary to install the v2.2.0.6 nuget package. The v2.2.0.6 build is only an alternative option if it would be easier to log an exception error when it fails rather than getting a protocol log.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

jstedfast commented 5 years ago

Yea, the problem is just that I don't see what the parsing error could be unless the token that the server is sending for the number of messages is either a negative integer or not an integer at all.

yZuoB commented 5 years ago

The problem reappears. I log it, but hide the password. The details are as follows I feel because I frequently connect to the server after the other side's defense means. --log content Connected to pop://pop.263.net:110/?starttls=when-available S: +OK Welcome to XMAIL POP3 Server Version 0.0.1 C: CAPA S: -ERR Unknow command CAPA C: USER manager@lumi.cn S: +OK XMAIL POP3 C: PASS ** S: +OK manager@lumi.cn C: CAPA S: -ERR Unknow command CAPA C: STAT S: +OK 22706 -2133832816

yaozuobang@163.com

From: Jeffrey Stedfast Date: 2019-06-19 17:31 To: jstedfast/MailKit CC: yZuoB; Author Subject: Re: [jstedfast/MailKit] Pop3Client Authenticate Error (#872) Yea, the problem is just that I don't see what the parsing error could be unless the token that the server is sending for the number of messages is either a negative integer or not an integer at all. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

jstedfast commented 5 years ago

This is the problem line: S: +OK 22706 -2133832816

Your POP3 server is saying that the total number of octets is a negative value, which is, obviously, incorrect.

Since the total number of octets isn't required for being able to properly download messages, I can just ignore the fact that it is negative.

jstedfast commented 5 years ago

I probably won't make a new release for another month or so, but in the meantime you can use the myget.org nuget package source to grab the latest builds.

Your issue will be fixed in v2.2.0.7 when it gets published (probably in ~30 minutes)