douqian1835 2014-07-17 12:31
浏览 66
已采纳

IMAP“UID获取”序列号

I'm coding an IMAP server in PHP. I'm testing my code with Thunderbird. When a client SELECTs a mailbox I respond with all necessary responses for the select command (Section 6.3.1 in RFC 3501). Including UIDNEXT. I have a own database for UIDs. The UIDs starts internally with number 100000. So with UIDNEXT I responde with the next free UID in my list. Thunderbird mostly selects new mails with xx UID fetch 100014:* (FLAGS) (e.g. for the 15th mail). xx is a number.

But from time to time Thunderbird tries to fetch this: xx UID fetch 174211265:* (FLAGS). The sequence number 174211265 doesn't even exist. And I never sent it to the client. So what to do? Select all from 100000 to 174211265? Even if the hightest UID number only is 100014? Thunderbird knows the next UID so why want to fetch 174211265?

  • 写回答

1条回答 默认 最新

  • dpmkif3097 2014-07-17 12:39
    关注

    Quoting RFC 3501:

       Also note that a UID range of 559:* always includes the
       UID of the last message in the mailbox, even if 559 is
       higher than any assigned UID value.  This is because the
       contents of a range are independent of the order of the
       range endpoints.  Thus, any UID range with * as one of
       the endpoints indicates at least one message (the
       message with the highest numbered UID), unless the
       mailbox is empty.
    

    So if the highest UID is 100014, and Thunderbird requests 174211265:*, that request is equivalent to 100014:174211265. Also:

      A non-existent unique identifier is ignored without any error
      message generated.  Thus, it is possible for a UID FETCH command
      to return an OK without any data or a UID COPY or UID STORE to
      return an OK without performing any operations.
    

    So the correct response would be to return only message 100014.

    Though it seems rather suspicious that Thunderbird would just make up that UID number, so I'd double-check the traffic between the client and the server to ensure that the server isn't sending incorrect data.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码