automatic
This commit is contained in:
@@ -151,7 +151,7 @@ def send_whatsapp_document(to: str, filename: str, data: bytes) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def fetch_unread_emails():
|
||||
def fetch_unread_emails(skip_whitelist: bool = False):
|
||||
"""Preia emailurile necitite din inbox fără a le salva sau marca ca citite."""
|
||||
mail = imaplib.IMAP4_SSL(IMAP_SERVER, IMAP_PORT)
|
||||
mail.login(IMAP_USER, IMAP_PASS)
|
||||
@@ -171,7 +171,7 @@ def fetch_unread_emails():
|
||||
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
|
||||
|
||||
# Extract attachment data (name → bytes)
|
||||
@@ -216,7 +216,7 @@ def mark_as_seen(email_ids: list[str]) -> None:
|
||||
|
||||
def run_forward():
|
||||
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