Fetch an email with imaplib but do not mark it as SEEN

PanosJee picture PanosJee · Jul 19, 2010 · Viewed 9.2k times · Source

I want to parse some emails from a user 's inbox but when I do:

typ, msg_data = imap_conn.fetch(uid, '(RFC822)')

It marks the email as SEEN or read. This is not the desired functionality. Do you know how can I keep the email at its previous stare either SEEN or NOT SEEN?

Answer

lezardo picture lezardo · Oct 18, 2010

You might also set read_only to true when selecting the folder:

imap_conn.select('Inbox', readonly=True)