You want UID SEARCH UID 3:*
. You're searching by message sequence numbers. 1 -> 2, 2 -> 5, 3 -> 6, 4 -> 51. So you're searching for messages 3 and 4, which have UIDs 6, and 51.
Gmail IMAP search by UID range seems to skip the first message
-
13-04-2022 - |
Question
I have a mailbox on gmail that has the following UIDs if I do a search 'ALL'.
[ 2, 5, 6, 51 ]
Oddly, if I do a search for '3:*', I only get [6, 51] back.
==> A6 UID SEARCH 3:*
<== '* SEARCH 6 51\r\nA6 OK SEARCH completed (Success)\r\n'
[parsing incoming] saw untagged SEARCH
<== 'A6 OK SEARCH completed (Success)\r\n'
From my understanding of IMAP, it is supposed to return [5, 6, 51] right? Is this a bug with Gmail or just my incorrect understandging?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow