diff --git a/tests/imap_fixture.py b/tests/imap_fixture.py index e26b4a8..b4247bb 100644 --- a/tests/imap_fixture.py +++ b/tests/imap_fixture.py @@ -79,8 +79,10 @@ def late(): a = old("alice", "alicepass") append(a, "INBOX", msg("late@test", "arrived after the bulk copy")) a.select("INBOX") - typ, data = a.search(None, "HEADER", "Message-ID", "") - a.store(data[0].split()[0], "+FLAGS", r"(\Seen)") + # Find m2 by its header (Stalwart's HEADER search is full-text, not substring). + 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"" in item[1]) + a.store(seq, "+FLAGS", r"(\Seen)") a.logout()