e2e: find m2 by header fetch

This commit is contained in:
grabowski committed 2026-10-23 10:27:26 +07:00
1 parent f723e1eaa8
commit d4d7d2e623
1 file changed
+4 -2
+4 -2
View File
@@ -79,8 +79,10 @@ def late():
a = old("alice", "alicepass") a = old("alice", "alicepass")
append(a, "INBOX", msg("late@test", "arrived after the bulk copy")) append(a, "INBOX", msg("late@test", "arrived after the bulk copy"))
a.select("INBOX") a.select("INBOX")
typ, data = a.search(None, "HEADER", "Message-ID", "<m2@test>") # Find m2 by its header (Stalwart's HEADER search is full-text, not substring).
a.store(data[0].split()[0], "+FLAGS", r"(\Seen)") typ, data = a.fetch("1:*", "(BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])")
seq = next(item[0].split()[0] for item in data if isinstance(item, tuple) and b"<m2@test>" in item[1])
a.store(seq, "+FLAGS", r"(\Seen)")
a.logout() a.logout()