简体   繁体   English

使用imaplib时邮件自动读取

[英]Messages autoread when using imaplib

I've been using imaplib and python for some time now and I've been rewriting some of my code. 我已经使用imaplib和python一段时间了,并且一直在重写一些代码。 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. 我在c.fetch('(UID BODY[HEADER])')使用此c.fetch('(UID BODY[HEADER])')查询。

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. 如果获取任何BODY部分,它将把消息标记为已读。 Use BODY.PEEK instead. 使用BODY.PEEK代替。

c.fetch('(UID BODY.PEEK[HEADER])')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM