Fix emails marked as read despite mark_as_read: false

Open IMAP folder in readonly mode when mark_as_read is false,
preventing FETCH RFC822 from implicitly setting the \Seen flag.
This commit is contained in:
Kacper Kwapisz
2026-03-25 16:46:10 +01:00
parent 56ebea20e9
commit 1d4fe9c4cf
+5 -1
View File
@@ -441,7 +441,11 @@ async def watch_folder(
client = None
try:
client = await asyncio.to_thread(get_imap_client, account)
await asyncio.to_thread(client.select_folder, folder)
await asyncio.to_thread(
client.select_folder,
folder,
readonly=not account.get("mark_as_read", False),
)
# Check IDLE support
if not client.has_capability("IDLE"):