foens/hpop

Pop3Client.IsOkResponse throws exception on successful authentication

Opened this issue · 2 comments

Hi all,

I use a Pop3Client during some of my tests and every once in awhile authentication of the client fails with this exception:

System.InvalidOperationException : Error setting up tests
  ----> OpenPop.Pop3.Exceptions.InvalidLoginException : Server did not accept user credentials
  ----> OpenPop.Pop3.Exceptions.PopServerException : The server did not respond with a + response. The response was: "\u0017\u0003\u0003\u0000P+OK Logged in."

It looks like the client's only check is for the '+' and does not take into account the possibility of these control characters being read by the stream and ignore that the authentication was successful.

If it is preferred for StreamUtility.ReadLineAsBytes to include control characters, then an update to IsOkResponse would make sense.

Thoughts?

same problem here.

"The server did not respond with a + response. The response was: "* OK inetserver.hos.com.br Zimbra IMAP4rev1 server ready""

my code

Using client As New OpenPop.Pop3.Pop3Client() client.Connect("mail.hos.com.br", 143, False) client.Authenticate(usuario, senha) Dim messageCount As Integer = client.GetMessageCount() Dim allMessages As New List(Of OpenPop.Mime.Message)(messageCount) For i As Integer = messageCount To 1 Step -1 allMessages.Add(client.GetMessage(i)) Next End Using

@MaiconLL Your problem is different from @123than's problem.

The problem you are having is that you are trying to connect to an IMAP server using a POP3 client.

If the server doesn't support POP3 on port 110 (instead of 143 for IMAP), I would recommend trying MailKit instead and using the ImapClient class.

Hope that helps.