Search using ['UID', next_message_id + ':*'] Always returns the last mailbox message
Example: I have a message with UID = 28.
Problem: Running ``imap.search([['UID', '1000:*']], function(err, results) {}) always returns the last message in the mailbox.
I'm storing the last UID of the mailbox processed. I just want to process the next ones after that.
Thanks!
Is 1000 the second to last message in the mailbox or ?
That's actually way far beyond it already. I had it exaggerated to test whether the bug is really there.
In reality, I actually have UID 27 as the last_message_id but using ['UID', '28:*'] and even ['UID', '1000:*'] seems to still return the last message.
Ok in that case, this is expected behavior. Quoted from RFC 3501:
Also note that a UID range of 559:* always includes the UID of the last message in the mailbox, even if 559 is higher than any assigned UID value. This is because the contents of a range are independent of the order of the range endpoints. Thus, any UID range with * as one of the endpoints indicates at least one message (the message with the highest numbered UID), unless the mailbox is empty.
So if you end up getting just one UID back, you'll just have to compare that against the last message UID you have stored.
Good idea. Thanks :+1: