Parse Gmail with Python and mark all older than date as "read"
email, gmail, imap, pop3, python
Solution
typ, data = M.search(None, '(BEFORE 01-Jan-2009)')
for num in data[0].split():
M.store(num, '+FLAGS', '\\Seen')
This is a slight modification of the code in the imaplib doc page for the store method. I found the search criteria to use from RFC 3501. This should get you started.
Problem
Long story short, I created a new gmail account, and linked several other accounts to it (each with 1000s of messages), which I am importing. All imported messages arrive as unread, but I need them to appear as read. I have a little experience with python, but I've only used mail and imaplib modules for sending mail, not processing accounts. Is there a way to bulk process all items in an inbox, and simply mark messages older than a specified date as read?