automatic
This commit is contained in:
@@ -47,7 +47,7 @@ def get_owner_jid() -> str:
|
||||
return f"{owner}@s.whatsapp.net"
|
||||
|
||||
|
||||
def fetch_unread_emails() -> list[dict]:
|
||||
def fetch_unread_emails(skip_whitelist: bool = False) -> list[dict]:
|
||||
"""Preia emailurile necitite din inbox fără a salva KB notes."""
|
||||
mail = imaplib.IMAP4_SSL(IMAP_SERVER, IMAP_PORT)
|
||||
mail.login(IMAP_USER, IMAP_PASS)
|
||||
@@ -66,7 +66,7 @@ def fetch_unread_emails() -> list[dict]:
|
||||
from_addr = decode_mime_header(msg['From'])
|
||||
sender_email = extract_sender_email(from_addr)
|
||||
|
||||
if sender_email not in WHITELIST:
|
||||
if not skip_whitelist and sender_email not in WHITELIST:
|
||||
continue
|
||||
|
||||
attachment_data = {}
|
||||
@@ -197,7 +197,7 @@ def send_whatsapp_document(to: str, filename: str, data: bytes) -> bool:
|
||||
|
||||
def run_digest():
|
||||
print("Verific emailuri necitite...")
|
||||
emails = fetch_unread_emails()
|
||||
emails = fetch_unread_emails(skip_whitelist=True)
|
||||
|
||||
owner_jid = get_owner_jid()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user