-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POP3 end of file reached error #311
Comments
I know that mailpit replies, because if I write the wrong password I get |
Sorry to hear you're having issues @antonionardella. I'm wondering if this was a result of a change we made in v1.18.3 (called dot-stuffing to prevent an email containing a single |
Hello @axllent! Thank you very much for your response! I tried also without TLS without success But I am having issues with POP3 even with telnet This is uncharted territory for me, so please bear with my lack of knowledge. |
That's all good. Port So at a guess it'll be something like: telnet localhost 1110
...
USER user
...
PASS pass
...
LIST
...
RETR 1
...
QUIT (I've added There are a lot more commands, but this should log you in as user |
I suspect that may be the case (an issue with Zammad) - but I can' t be 100% sure as I don't know that software. I have tested with Thunderbird & telnet, but I'm assuming it should work with all POP3 clients. Zammad is open source, so maybe they can help? |
Zammad is open source, yes. I posted to their forum https://community.zammad.org/t/pop3-issues-with-mailpit/14629 Again, thanks for your time. |
Hello @axllent I got this feedback from the zammad team:
Not sure if there is time from your side to do anything about it, but at least we know more now.
Each line is expected to contain a message number and a size, separated by whitespace. The regular expression \A(\d+)[ \t]+(\d+) is used to match lines that start with one or more digits (message number), followed by one or more spaces or tabs, followed by one or more digits (message size). If the line does not match this format, an exception POPBadResponse is raised with the message "bad response: #{line}". Given this LIST response from mailpit when the
I see now where it might be incompatible. According to the RFC 1939 https://www.rfc-editor.org/rfc/rfc1939#page-6 The list example looks like the following:
|
Alright, the size part should be fixed with this PR: #312 Now I have to understand why I am getting the |
Further help from Zammad comes from
|
I was able to make it work with this commit antonionardella@e2f28f1 But it is also a huge refactoring of your code, so I am not pushing a PR unless you would like to do so. This way Zammad was perfectly able to set up the POP3 mailbox without any issues so far I was not able to compile the front-end on Windows (had no time to set up the node env), so please test it if possible Have a great day! |
@antonionardella Firstly thank you so much for looking into this, identifying the bug, and the PR. It's the start of another busy workday for me (plus I have another event this evening I have to attend) so I will look at this as soon as I'm able to (including your latest commit). If not today then tomorrow... |
No hurry at all! Please. Take your priorities first, I am only hoping that this is helping, more than making further mess (since I am not a professional developer). Enjoy your day and weekend! |
It is helping more than you know! The POP3 server implementation was originally a bit of a hack (and not something I personally use), so clearly some bugs have crept in over time, nor was it seemingly fully compliant. Compliance is something I strive for in Mailpit, so POP3 shouldn't be any different. |
Readded also the websocket support |
@antonionardella Firstly, I have merged the first PR - thank you, Mailpit was in fact printing garbage sizes, and the RFC 600-second timeout was a good catch too. Secondly, I have been looking at your refactored branch which looks a lot nicer than my version, but which has some flaws in the logic (probably due to over-simplification). Before I get into that though, I'm curious as to what part exactly solved the issue with zammad? Was it just the fact that the sizes were incorrectly formatted (ie: Generally speaking with POP3:
In your refactored code however, you have greatly simplified the logic to just two states: In your refactor the following works when it shouldn't be allowed (note how there is no telnet localhost 1110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Mailpit POP3 server
USER user
+OK
LIST
+OK 0 messages (0 octets)
. So to summarise - I like/prefer your refactored structure (it is much tidier), but there is a bit too much oversimplification of the logic which is resulting in non-compliant POP3. I think a few additional checks in your code would fix it though, but they are definitely needed. I'm also very curious to know what exactly fixed zammad. |
Hello @axllent and thank you for your extensive feedback! To add some context and pointers: The first and merged PR (thank you!) fixed the size reporting issue described here: #311 (comment) After that, the ruby library, net-pop used by Zammad was only giving an Once I applied my hack I was able to successfully add the mailpit POP3 mailbox to Zammad without errors, which also sends and retrieves a test email using the library. I will look into it and add the checks to reach compliance and compatibility, thank you for taking the time to go through the code and add your valuable comments. |
I took some time to refactor the code a little bit more: Now the code allows specific commands either in I also change the wording to make it easier to read the code according to the RFC (changed Let me know if this works for you and is getting closer to the RFCs as expected. I was able to compile it and test it with Best, |
@antonionardella This code is looking much cleaner than my version, so thank you! I haven't tested it yet (I'm not able to today, but will try in about 24h) - sorry. From what I can see thought your implementation should work as expected. I'm still curious as to why Zammad is working with your version and not mine, do you have any idea? I promise to look into your version as soon as I'm able to, I'm just very busy right now and need to get to bed. |
I should also add that the web UI is not important for this, in fact the two are not linked in any way. POP3 is only for POP3 clients, not the web UI 👍 |
Good question, I added a handler specifically for EOF errors, which might be the key to the whole issue |
Actually that's not really a handler, but rather just "hiding" (using the debug log) the logged If Zammad isn't working after the first int64() fix, then I think it must actually be something else. Would you mind please confirming for me if the current In addition to that, running Mailpit with the
Do you mind providing me with the output displayed ( I've tested your version using Thunderbird and it works fine for me, so I'll be happy for another MR once we can find out exactly what was broken (if it was actually broken) after the previous int64() fix. Thanks! |
Yes, I believe you are right! Good catch - Mailpit was just closing the connection without returning a response to the Would you mind opening another PR (you closed the original one) with your current code and I will get that merged in (and released as soon as possible)? Thanks @antonionardella! |
PR is open Thanks a lot for your questions, feedback, time and awesome project! |
You're very welcome, and thank you for all your hard work finding & fixing the bug(s), plus refactoring the POP3 code (it is so much better now)! I also made a few more additional changes:
Your changes, my changes, and some dependency updates to the Go & JS libraries have been released in v.1.18.6 🎉 Thanks again! ❤️ |
Hello,
I am trying to set up mailpit to be used as mock email server for a staging installation of https://github.com/zammad/zammad according to their documentation here: https://admin-docs.zammad.org/en/latest/channels/email/index.html
This to see if the email are sent and received correctly and do further testing in a staging environment.
My issue is that once I set up mailpit and the pop3 connection parameters in zammad all I get is:
end of file reached
on Zammad's sideand
ERRO[2024/06/12 13:20:15] [pop3] EOF
on mailpits side.I installed
mkcert
to create certificates and keys like so:To generate certs for the IP of the test server
Then a pop3 auth file which contains nothing but
user:pass
Then I start mailpit with
mailpit --pop3-auth-file ./mailpit.auth --pop3-tls-cert ./cert.pem --pop3-tls-key ./key.pem
What else could I try to make this work or debug it?
Thanks
The text was updated successfully, but these errors were encountered: