Skip to content
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 server does not do dot stuffing #299

Closed
henningp opened this issue May 18, 2024 · 6 comments · Fixed by #300
Closed

POP3 server does not do dot stuffing #299

henningp opened this issue May 18, 2024 · 6 comments · Fixed by #300

Comments

@henningp
Copy link
Contributor

The POP3 server currently doesn't do "dot stuffing".

From the POP3 spec:

When all lines of the response have been sent, a
final line is sent, consisting of a termination octet (decimal code
046, ".") and a CRLF pair. If any line of the multi-line response
begins with the termination octet, the line is "byte-stuffed" by
pre-pending the termination octet to that line of the response.

In practice, this means that any message line starting with a dot must have an extra dot added at the start of the line. (The same technique is used in SMTP.) Mailpit's POP3 doesn't do this, resulting in dots at the start of lines going missing when getting messages via POP3.

@axllent
Copy link
Owner

axllent commented May 18, 2024

@henningp - thank you, I did not know this. So if I understand this correctly, a message that contains the following in the returned body (from a POP3 server):

this is a test
.02 test
blaah

would get "translated" (transformed) by any POP3 client to:

this is a test
02 test
blaah

?

In order to address this, we need to prepend a dot on any line that starts with a dot to result in:

this is a test
..02 test
blaah

Am I 100% correct in my understanding?

@henningp
Copy link
Contributor Author

Hi @axllent, neither did I know about this until this week, and it was a royal pain to debug 😀 Yes, your understanding is exactly correct! Thanks for your swift reply.
I‘m running a patched Mailpit for now with this fix, and that stopped dots from going missing seemingly at random in my tests using POP3.

@axllent
Copy link
Owner

axllent commented May 18, 2024

Thanks so much @henningp - I really appreciate it! I suspect I may have come across this issue before but never worked it out :-)

Your patch looks good (well done) - so I'll merge this soon (I'm just working on something else right now) and get a new release out as soon as I can.

@henningp
Copy link
Contributor Author

Brilliant, thanks! 😊

@axllent
Copy link
Owner

axllent commented May 18, 2024

This has been released in v1.18.3 :) Thanks again for your PR @henningp!

@henningp
Copy link
Contributor Author

Oh wow, thank you @axllent! :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants