IMAP COPY 命令 - uid 和 Message-Id
我知道 UID 会发生变化,但在对特定邮件进行任何操作期间,Message-Id 不会更改。然而,经过一些操作后,我想到了这种情况:
假设我的 INBOX
中有 总共 2000 封电子邮件
。如果我将带有 UID 1000
和 Message-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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果 IMAP 服务器支持,您可以使用 SORT 命令,如 RFC 5256 中所述。您正在寻找的特定命令可能是:
服务器响应是可用于后续提取的消息序列号列表。
如果您的服务器支持
SORT
扩展(现代IMAP服务器支持),它将在响应CAPABILITY
命令时宣布。以下是我正在运行的旧版 Courier-IMAP 的响应: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:
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 theCAPABILITY
command. Here's a response from the ancient version of Courier-IMAP I'm running: