V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
pxiphx891
V2EX  ›  分享发现

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

  •  
  •   pxiphx891 · 85 天前 · 1125 次点击
    这是一个创建于 85 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近通过 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"才对

    3 条回复    2025-04-11 11:52:46 +08:00
    565656
        1
    565656  
       85 天前
    我们公司用的腾讯企业邮箱 妈的电脑客户端要用企业微信 不然就用丑到爆不更新的 foxmail
    pxiphx891
        2
    pxiphx891  
    OP
       84 天前
    有没有 QQ 邮箱的同学呀?能不能帮忙反馈下?还是我使用姿势有问题?
    julyclyde
        3
    julyclyde  
       84 天前   ❤️ 1
    类似的问题在当年 foxmail 邮件客户的时候就存在了
    已经 30 年了
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1133 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 23:41 · PVG 07:41 · LAX 16:41 · JFK 19:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.