IMAP" UID fetch"序号

时间:2014-07-17 12:31:36

标签: php database imap

我正在编码IMAP server in PHP。我用Thunderbird测试我的代码。当客户端SELECT是邮箱时,我会响应select命令的所有必要响应(RFC 3501中的第6.3.1节)。包括UIDNEXT。我有own database for UIDs。 UID从内部开始,编号为100000.因此,使用UIDNEXT,我会回复列表中的下一个免费UID。 Thunderbird主要选择xx UID fetch 100014:* (FLAGS)的新邮件(例如第15封邮件)。 xx是一个数字。

但Thunderbird不时会尝试获取此内容:xx UID fetch 174211265:* (FLAGS)。序列号174211265甚至不存在。而且我从未将它发送给客户。那么该怎么办?全选从100000到174211265?即使最高的UID号码只有100014? Thunderbird知道下一个UID所以为什么要拿取174211265?

1 个答案:

答案 0 :(得分:2)

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.

因此,如果最高UID为100014,而Thunderbird请求174211265:*,则该请求等同于100014:174211265。也:

  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.

因此,正确的答案是仅返回消息100014。

虽然Thunderbird只是构成UID号码似乎相当可疑,但我要仔细检查客户端和服务器之间的流量,以确保服务器不会发送错误的数据。 / p>