feat(email): add postActionExpunge option to gate broad IMAP expunge

This commit is contained in:
Flávio Veloso Soares
2026-06-09 14:50:59 +08:00
committed by Xubin Ren
parent 1d683f0f18
commit 6de8d7f52e
2 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -56,6 +56,7 @@ class EmailConfig(Base):
mark_seen: bool = True
post_action: Literal["delete", "move"] | None = None
post_action_move_mailbox: str | None = None
post_action_expunge: bool = False
post_action_ignore_skipped: bool = True
max_body_chars: int = 12000
subject_prefix: str = "Re: "
@@ -739,7 +740,8 @@ class EmailChannel(BaseChannel):
if status == "OK":
return
self.logger.warning("UID EXPUNGE failed for UID {}, falling back to EXPUNGE", uid)
client.expunge()
if self.config.post_action_expunge:
client.expunge()
@classmethod
def _is_stale_imap_error(cls, exc: Exception) -> bool: