From d704f9c7e859928131c1cad77a241440fb0b00bf Mon Sep 17 00:00:00 2001 From: Ahosking Date: Mon, 30 Dec 2024 21:31:13 +0000 Subject: [PATCH] Zero was not being counted. This fixes that --- gmail/email_count.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gmail/email_count.py b/gmail/email_count.py index d9da918..c413634 100644 --- a/gmail/email_count.py +++ b/gmail/email_count.py @@ -30,7 +30,7 @@ client = influxdb_client.InfluxDBClient( for account in accounts: with imaplib.IMAP4_SSL(host="imap.gmail.com", port=imaplib.IMAP4_SSL_PORT) as imap_ssl: print("Connection Object : {}".format(imap_ssl)) - print("Logging into mailbox...") + print(f"Logging into mailbox {account}...") try: resp_code, response = imap_ssl.login(account, accounts[account]) except Exception as e: @@ -52,10 +52,10 @@ for account in accounts: unread_messages = 0 ############### Logout of Mailbox ###################### - print("\nLogging Out....") - + print(f"\nLogging Out of {account}....") + imap_ssl.close() - if unread_messages: + if unread_messages is not None: message = f"{account} has {unread_messages} messages." date = strftime("%Y-%m-%d") time = strftime("%H:%M:%S")