IMAP:搜索UID大于X的消息(或通常在上次搜索后) [英] IMAP: Search for messages with UID greater than X (or generally, after my last search)
问题描述
或者,更一般地,我正在寻找一种只能从上次搜索以来看到消息的方式。
请注意,我不是在寻找看到/看不见的消息;脚本以只读方式打开邮箱,我希望它不会干扰我的标志等。
我知道我可以在IMAP中指定一个日期搜索,但它的粒度似乎是在一天,所以不完全是我需要的。
我从Gmail开始作为IMAP服务器,但是想支持将来的通用IMAP服务器。
有没有办法搜索UID大于X的电子邮件?还是从消息X指定所有消息的另一种方法?
您可以使用IMAP SEARCH查找UID。假设你最近获取的UID是1999,我想你会做的:
搜索UID 2000:*
p>
I'm writing a script to analyze my mailbox and want to periodically check for new messages. The search criteria would be: give me the UIDs for all emails with UID greater than X, where X is the UID of the last email I processed.
Or, more generally, I'm looking for a way to only see messages since my last search.
Note that I'm not looking for seen/unseen messages; the script opens the mailbox as read-only, and I'd like it to not interfere with my flags, etc.
I know I can specify a date in the IMAP search, but the granularity of that seems to be by day, so not exactly what I need.
I'm starting with Gmail as the IMAP server, but would like to support generic IMAP servers in the future.
Is there way to search for emails with UID greater than X? Or another means of specify all messages since message X?
You can use IMAP SEARCH for UIDs. Assuming your most recently fetched UID is 1999, I think you would do:
SEARCH UID 2000:*
这篇关于IMAP:搜索UID大于X的消息(或通常在上次搜索后)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!