andyedinborough / aenetmail

C# POP/IMAP Mail Client
369 stars 153 forks source link

Error deleting via POP in hMailServer #174

Open asherber opened 9 years ago

asherber commented 9 years ago

I'm testing against a local instance of hMailServer. When I delete a message via POP, the hMailServer logs show that it returns "+OK msg deleted". But there appear to be some control characters in the stream before the +OK, starting with 10 13, so Utilities.ReadLine() returns "" and CheckResultOK() throws an exception.

In the debugger, the first bytes of the stream are 10 13 10 46 13 10 43 79 75 (that's the +OK at the end).

Is hMailServer doing something really odd here, or is it a bug in AE.Net.Mail? (Or should AE.Net.Mail just be more tolerant?)

asherber commented 9 years ago

Here's a capture from RawCap:

+OK POP3
USER foo@bar.com
+OK Send your password
PASS password
+OK Mailbox locked and ready
STAT
+OK 2 972
RETR 1
+OK 486 octets
Return-Path: foo@bar.com
Received: from [127.0.0.1] (mgtest [127.0.0.1])
.by LIGHTNING
.; Thu, 30 Oct 2014 08:57:52 -0400
Message-ID: <545235B0.2060106@bar.com>
Date: Thu, 30 Oct 2014 08:57:20 -0400
From: Aaron Sherber <foo@bar.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version: 1.0
To: foo@bar.com
Subject: Test Message 1
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
.
DELE 1
+OK msg deleted

And the last couple of lines in hex dump mode from RawCap:

image

So I'm not sure why AE.Net.Mail is seeing those leading control chars. (FWIW, this appears to work fine with MailKit and OpaqueMail.)