QQ 邮箱的 POP3 服务器没有正确实现 RFC1939 byte-stuffed 规范

85 天前
 pxiphx891

最近通过 POP3 读取 QQ 邮箱的邮件,发现只要读取某封邮件后就会报错,debug 后发现,邮件片段是这样的:

* Support emails, files, beta testing, and documents.

Please note that our system did not have any backups saved for your account=
.

1 Second Everyday is a great way to capture and relive your favorite moment=
s. We're always looking forward to your return!

根据 RFC1939 ,"\r\n.\r\n"是邮件内容结束的标记,如果有一行开头是".",那么服务器应该在前面增加一个"."作为转义。腾讯没有正确实现这一点,导致我无法使用 eclipse-ee4j/angus-mail 解析邮件。

参考: https://www.ietf.org/rfc/rfc1939.txt

Responses to certain commands are multi-line. In these cases, which are clearly indicated below, after sending the first line of the response and a CRLF, any additional lines are sent, each terminated by a CRLF pair. 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. Hence a multi-line response is terminated with the five octets "CRLF.CRLF". When examining a multi-line response, the client checks to see if the line begins with the termination octet. If so and if octets other than CRLF follow, the first octet of the line (the termination octet) is stripped away. If so and if CRLF immediately follows the termination character, then the response from the POP server is ended and the line containing ".CRLF" is not considered part of the multi-line response.

eclipse-ee4j/angus-mail 的代码在这里: https://github.com/eclipse-ee4j/angus-mail/blob/master/providers/pop3/src/main/java/org/eclipse/angus/mail/pop3/Protocol.java 第 992 行,读取到"\n.\r",就认为邮件结束了。腾讯应该返回"\n..\r"才对

1125 次点击
所在节点    分享发现
3 条回复
565656
85 天前
我们公司用的腾讯企业邮箱 妈的电脑客户端要用企业微信 不然就用丑到爆不更新的 foxmail
pxiphx891
85 天前
有没有 QQ 邮箱的同学呀?能不能帮忙反馈下?还是我使用姿势有问题?
julyclyde
84 天前
类似的问题在当年 foxmail 邮件客户的时候就存在了
已经 30 年了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://ex.noerr.eu.org/t/1124605

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX