- IMAP connections now use a 120s socket timeout. Without it the poll
hung for 5 days in logout() on a silently dropped connection; every
later poll was skipped ("max instances reached"), so nothing got
sorted and newly created rules were never evaluated.
- Header decoding joined decode_header() parts with " " although the
whitespace is already part of the unencoded chunks, producing
"IT-Mönch <noreply@…>" (two spaces) — the it-moench rule could never
match. Join without separator and collapse whitespace/folded lines.
- Rule text matching (contains/exact) normalizes whitespace on both
sides, so stray or doubled spaces in rule values no longer break them.
- Pseudo charsets (unknown-8bit, …) try UTF-8 before latin-1, fixing
mojibake like "nächster" in raw 8-bit headers.
- Fetch via BODY.PEEK[] instead of RFC822, which set \Seen on every
evaluated mail. Payload is located by shape in the FETCH response,
fixing "'int' object has no attribute 'decode'".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>