Agent Zero AI framework
fix(email): skip noreply/no-reply sender addresses in IMAP and Exchange polling
linuztx9cf774046326
diff --git a/plugins/_email_integration/helpers/imap_client.py b/plugins/_email_integration/helpers/imap_client.pyindex a4dd02d50..98bdb7ebe 100644--- a/plugins/_email_integration/helpers/imap_client.py+++ b/plugins/_email_integration/helpers/imap_client.py@@ -155,6 +155,8 @@ async def _fetch_single(email_msg = email.message_from_bytes(email_data)sender = _decode_header(email_msg.get("From", ""))+ if _is_noreply(sender):+ return Noneif sender_whitelist and not _matches_whitelist(sender, sender_whitelist):return None@@ -219,6 +221,8 @@ async def fetch_unread_exchange(for item in items:sender = str(item.sender.email_address) if item.sender else ""+ if _is_noreply(sender):+ continueif sender_whitelist and not _matches_whitelist(sender, sender_whitelist):continue@@ -362,6 +366,19 @@ def _decode_header(header: str) -> str:return " ".join(parts)+def _is_noreply(sender: str) -> bool:+ addr = sender.lower()+ match = re.search(r"<([^>]+)>", addr)+ if match:+ addr = match.group(1)+ local = addr.split("@")[0] if "@" in addr else addr+ return local in (+ "noreply", "no-reply", "no_reply",+ "donotreply", "do-not-reply", "do_not_reply",+ "mailer-daemon", "postmaster",+ )++def _matches_whitelist(sender: str, whitelist: list[str]) -> bool:sender_lower = sender.lower()for pattern in whitelist: