From 23cd165d2d43f60cd784ed15312c2b8dfa0ddb93 Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Sun, 8 Jan 2023 14:13:55 -0500 Subject: [PATCH] Clean up output --- gmail/email_count.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gmail/email_count.py b/gmail/email_count.py index 5e05ed0..e426bbb 100644 --- a/gmail/email_count.py +++ b/gmail/email_count.py @@ -30,13 +30,16 @@ for account in accounts: resp_code, messages = imap_ssl.search(None, 'UnSeen') if resp_code == 'OK': if len(messages[0].split()) > 0: - print('True') - print(messages[0].split()) - print(len(messages[0].split())) + #print('True') + #print(messages[0].split()) + unread_messages = len(messages[0].split()) else: print('False') ############### Logout of Mailbox ###################### print("\nLogging Out....") - imap_ssl.close() \ No newline at end of file + imap_ssl.close() + if unread_messages: + message = f"{account} has {unread_messages} messages." + print(message)