mirror of
https://github.com/chatmail/core.git
synced 2026-09-22 13:01:21 +03:00
test(direct_imap): always pass mark_seen=False to fetch()
mark_seen=True is the default and translates to fetching BODY of the message. mark_seen=False translates to fetching BODY.PEEK that is described in IETF RFC 3501 as "An alternate form of BODY[<section>] that does not implicitly set the \Seen flag." It is unexpected unless you know this detail of IMAP protocol already, but this is not going to be fixed in imap_tools: <https://github.com/ikvk/imap_tools/issues/179>
This commit is contained in:
@@ -171,7 +171,7 @@ class DirectImap:
|
||||
self.conn.append(bytes(msg, encoding="ascii"), folder)
|
||||
|
||||
def get_uid_by_message_id(self, message_id) -> str:
|
||||
msgs = [msg.uid for msg in self.conn.fetch(AND(header=Header("MESSAGE-ID", message_id)))]
|
||||
msgs = [msg.uid for msg in self.conn.fetch(AND(header=Header("MESSAGE-ID", message_id)), mark_seen=False)]
|
||||
if len(msgs) == 0:
|
||||
raise Exception("Did not find message " + message_id + ", maybe you forgot to select the correct folder?")
|
||||
return msgs[0]
|
||||
|
||||
Reference in New Issue
Block a user