IMAP COPY 命令 - uid 和 Message-Id

发布于 2024-10-26 04:24:58 字数 468 浏览 2 评论 0原文

我知道 UID 会发生变化,但在对特定邮件进行任何操作期​​间,Message-Id 不会更改。然而,经过一些操作后,我想到了这种情况:

假设我的 INBOX 中有 总共 2000 封电子邮件。如果我将带有 UID 1000Message-Id 1000 的第 1000 封电子邮件复制到我的 Trash 邮箱,然后复制返回INBOX,UID 将更改为 2000,Message-Id 将更改为 2000;该文件夹的当前值。然后,无论日期如何,该电子邮件都会位于顶部。

现在的问题是,如果我 .快速获取 1990:2000(最后 10 封电子邮件),我将在获取的 10 封电子邮件中获取该特定电子邮件。如何根据日期获取最后 10 封电子邮件,而不必获取 2000 封电子邮件,然后按日期对它们进行排序?

I understood that UID changes but the Message-Id will not be changed during any operation on a particular mail. However, after some operations I came up with this case:

Lets assume I have a total of 2000 emails in my INBOX. If I copy the 1000th email with UID 1000 and Message-Id 1000 to my Trash mailbox and then I copy that back to the INBOX, the UID will change to 2000 and Message-Id to 2000; the current for that folder. Then, regardless of the date that email will be at the top.

Now the question is, if I . fetch 1990:2000 fast (the last 10 emails), I'll get the that particular email among the 10 fetched. How would you fetch the last 10 based on the date without having to fetch 2000 emails and then sort them out by date?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜司空 2024-11-02 04:24:58

如果 IMAP 服务器支持,您可以使用 SORT 命令,如 RFC 5256 中所述。您正在寻找的特定命令可能是:

C: A11 SORT (REVERSE DATE) UTF-8 ALL
S: * SORT 5 3 4 1 2
S: A11 OK SORT completed

服务器响应是可用于后续提取的消息序列号列表。


如果您的服务器支持SORT扩展(现代IMAP服务器支持),它将在响应CAPABILITY命令时宣布。以下是我正在运行的旧版 Courier-IMAP 的响应:

CAPABILITY
* CAPABILITY IMAP4rev1 CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES
  SORT QUOTA LOGIN IDLE ACL ACL2=UNION STARTTLS

If the IMAP server supports it, you can use the SORT command for this, as descibed in RFC 5256. The specific command you're looking for is probably:

C: A11 SORT (REVERSE DATE) UTF-8 ALL
S: * SORT 5 3 4 1 2
S: A11 OK SORT completed

The server response is a list of message sequence numbers that you can use for a subsequent fetch.


If your server supports the SORT extension (modern IMAP servers do), it will be announced in response to the CAPABILITY command. Here's a response from the ancient version of Courier-IMAP I'm running:

CAPABILITY
* CAPABILITY IMAP4rev1 CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES
  SORT QUOTA LOGIN IDLE ACL ACL2=UNION STARTTLS
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文