I'm working with some code in python with the exchangelib library, I'm trying to print a list of specific email addresses with a counter that counts the amount of emails recieved from that emailaddress. This is my code, but I'm not getting any printed output.
from exchangelib import Credentials, Account
from collections import defaultdict
emails = ['email1@example.com','email2@example.dk']
credentials = Credentials('random@user.dk', 'Brute')
account = Account('random@user.dk', credentials=credentials, autodiscover=True)
def count_senders(emails):
counts = defaultdict(int)
for email in emails:
counts[email.sender.email_address] += 1
return counts
print(counts)