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")