From 30678e6abfffd89dde36e84b0e89b8ed19f43f90 Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Tue, 21 Apr 2026 20:29:58 +0000 Subject: [PATCH] fix(email): send WhatsApp notification when no new emails found Previously digest and forward commands silently exited when inbox was empty, leaving the user with no feedback after the initial "processing..." confirmation. Co-Authored-By: Claude Sonnet 4.6 --- tools/email_digest.py | 6 ++++-- tools/email_forward.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/email_digest.py b/tools/email_digest.py index eccde6b..b2ce8eb 100644 --- a/tools/email_digest.py +++ b/tools/email_digest.py @@ -98,12 +98,14 @@ def run_digest(): print("📬 Verific emailuri necitite...") saved = save_unread_emails() + owner_jid = get_owner_jid() + if not saved: print("Niciun email nou de procesat.") + if not DRY_RUN: + send_whatsapp(owner_jid, "📭 Nu sunt emailuri noi.") return - owner_jid = get_owner_jid() - for result in saved: if not result.get("ok"): print(f"⚠️ Sărit: {result.get('error')}") diff --git a/tools/email_forward.py b/tools/email_forward.py index eec6c93..f7a46f9 100644 --- a/tools/email_forward.py +++ b/tools/email_forward.py @@ -148,12 +148,14 @@ def run_forward(): print("Verific emailuri necitite...") emails = fetch_unread_emails() + owner_jid = get_owner_jid() + if not emails: print("Niciun email nou de procesat.") + if not DRY_RUN: + send_whatsapp(owner_jid, "📭 Nu sunt emailuri noi.") return - owner_jid = get_owner_jid() - for em in emails: subject = em['subject'] print(f"Trimit: {subject}")