最近通过 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 解析邮件。
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"
才对
1
565656 85 天前
我们公司用的腾讯企业邮箱 妈的电脑客户端要用企业微信 不然就用丑到爆不更新的 foxmail
|
2
pxiphx891 OP 有没有 QQ 邮箱的同学呀?能不能帮忙反馈下?还是我使用姿势有问题?
|
3
julyclyde 84 天前 ![]() 类似的问题在当年 foxmail 邮件客户的时候就存在了
已经 30 年了 |