From d31ec18ea32733d0722b1dcbd9fdd81d6f4e2c18 Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Mon, 13 Jul 2026 07:13:08 +0800 Subject: [PATCH] fix: restore -FLAGS Seen after FETCH, protected by _processing_uids --- src/email_client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/email_client.py b/src/email_client.py index cf388da..7f347ad 100644 --- a/src/email_client.py +++ b/src/email_client.py @@ -163,6 +163,9 @@ def fetch_unseen_emails(account: EmailAccount) -> list[Email]: emails.append(Email(uid=uid, subject=subject, sender=sender, recipient=recipient, body=body, date=date_str, reply_to=reply_to, account_email=account.username, folder=folder)) + + # FETCH 可能被服务器自动标已读,立即标回未读 + conn.uid("STORE", uid, "-FLAGS", "\\Seen") except Exception as e: logger.error(" UID %s FETCH 失败,跳过: %s", uid, e) continue