MBOX-Line: From sflist at ihonk.com  Sun Jan  6 19:50:10 2008
To: imap-protocol@u.washington.edu
From: Steve Freitas <sflist@ihonk.com>
Date: Fri Jun  8 12:34:41 2018
Subject: [Imap-protocol] Checking for new messages
Message-ID: <1199677810.8368.16.camel@infidel>

Hi,

I'm implementing software which picks up and processes new email from
various IMAP servers. It logs in, does its thing, then logs out. The
accounts which are being checked are not being exclusively checked by my
software, so there are no guarantees about any flags being set on
messages, such as \Recent or \Seen. I need to avoid processing any
messages twice, and I'm not allowed to miss any new messages. (Nor am I
allowed to delete any messages.)

With POP3, determining whether new messages have arrived is quite
straightforward: Store a list of UIDs from past connections, then do a
UIDL on the POP3 server and compare the results.

With IMAP4, it seems to be more complicated, but I hope I'm missing
something here. I can't use message sequence numbers in any way to do
this, because they're unstable (since deleting a message decrements all
sequence numbers above that of the deleted message). And I can't use
UIDs if, like I'm experiencing when dealing with the Courier IMAP
server, I get a new UIDVALIDITY number every time I connect to the
server and open a mailbox.

So what's left? SEARCH SINCE? Is that going to find something new if the
date information in the message's header is wrong? And since I can only
narrow down to a day, I'm still going to have to look at headers to
determine whether I've seen the message before, right?

Any help would be appreciated.

Thanks!

Steve


