I am using imaplib to access emails for a Python script. I want to search for all emails received after the last time the script was run.
mail.search(None,'(FROM "[email protected]" SUBJECT "xyz" SINCE {last_timestamp})')
Unfortunately search ignores the time and only considers the date. Thus some old emails are retrieved if they were received on the same day as last_timestamp even though they are prior to the exact time.
As a workaround, I store email IDs and remove old ones from the search results. I'm wondering if there is a more elegant solution.
Try searching for unseen