From 8e5faf48f2586abe6293fc9e31fd9ba50be006ac Mon Sep 17 00:00:00 2001 From: thopic Date: Tue, 18 May 2021 11:16:37 +0200 Subject: [PATCH] Add Mailcow emails count script --- count_emails.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 count_emails.py diff --git a/count_emails.py b/count_emails.py new file mode 100755 index 0000000..d5b69d1 --- /dev/null +++ b/count_emails.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +import api_requests as api + +ENDPOINT = 'get/mailbox/all' +emails_count = 0 + +try: + for user in api.mailcow(ENDPOINT): + emails_count += user["messages"] +except TypeError: + print("Mailcow : What is your IP address ?") + +print("Emails count : " + str(emails_count))