imapimaplib

IMAP Search with uid and date criteria


I try to create this IMAP query, both criteria should be applied (AND):

(SINCE "19-JUN-2023" UID 8:*)

So, '1' (older) is correctly ignored. However, it returns these uids: [b'2', b'3', b'4', b'5', b'6', b'7'], where as it should imho return none (since all are below 8). What am I doing wrong?

I use the Python Imaplib, like this:

status, data = connection.search(None, criteria)

Solution

  • Your search says "search for messages dated since june 19 and UIDs ≥ 8, and return their MSNs". You probably want to get UIDs back, for which you need a command such as .uid("search", "since ...