使用 imaplib 获取电子邮件,但不要将其标记为 SEEN

2022-01-23 00:00:00 python gmail imaplib

问题描述

我想解析来自用户收件箱的一些电子邮件,但是当我这样做时:

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?


解决方案

您也可以在选择文件夹时将 read_only 设置为 true:

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

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

相关文章