I've been using imaplib and python for some time now and I've been rewriting some of my code. I've recently run into an issue where the messages are being set to read when I access the headers for the emails.
I'm using this c.fetch('(UID BODY[HEADER])')
query in imaplib.
So, my question comes down to this. Why are the messages being set as read? And how do I reverse this so that they do not change the read flag on these messages?
If you fetch any BODY
section, it will mark the message as read. Use BODY.PEEK
instead.
c.fetch('(UID BODY.PEEK[HEADER])')