开发者

How reliable are IMAP UIDs?

开发者 https://www.devze.com 2023-01-31 17:39 出处:网络
I\'m writing an IMAP crawler, which is part of an Open Source app, and for incremental crawling I\'d like to use the message UIDs to find out whether I\'ve already 开发者_如何学Goseen a particular mes

I'm writing an IMAP crawler, which is part of an Open Source app, and for incremental crawling I'd like to use the message UIDs to find out whether I've already 开发者_如何学Goseen a particular message or not.

Now I found a post from 2007 that says IMAP UIDs aren't always reliable. More specifically, if the flag UIDNOTSTICKY is set, you can't assume the UIDs are always the same. So my question is, do I have to take the case UIDNOTSTICKY=true seriously, or are IMAP servers with non-sticky UIDs legacy stuff and not in (widespread) use anymore?


If the UIDNOTSTICKY response code is returned during a SELECT or EXAMINE, you'll also see that the UIDVALIDITY value on the mailbox (the IMAP term for a folder) changes every time you SELECT or EXAMINE the mailbox. But you have to check for a change in UIDVALIDITY anyway since the mailbox's UIDVALIDITY is not guaranteed immutable, and any such change invalidates your cached UIDs. Yes, UIDVALIDITY values generally don't change. But your code's going to have to deal with that case, and by doing so you'll have also covered the UIDNOTSTICKY case.

0

精彩评论

暂无评论...
验证码 换一张
取 消