So I know how to get emails that are unseen
And I know how to get emails before a certain date.
But how do I combine these 2 to get all emails that are unseen before a certain date?
conn = imaplib.IMAP4_SSL("imap.gmail.com", 993)
typ, data = conn.search(None, 'BEFORE', before_date) //before a date
typ, data = conn.search(None, 'UNSEEN') //all un seen
Just put your two conditions one after the other, like this:
Reference: section 6.4.4 of the IMAP RFC (RFC3501) says this:
-Phil