importdatetimefrom exchangelib import(
Credentials,
Account,
DELEGATE,
Configuration,
FileAttachment,
EWSDateTime,
EWSTimeZone,
)from exchangelib.protocol importCachingProtocolclassEmailLoader:def __init__(self, username, password):
self.username=username
self.password=password
self.account=self.connect_to_mailbox()defconnect_to_mailbox(self):
cred=Credentials(self.username, self.password)
config= Configuration(server="outlook.office365.com", credentials=cred,)
account=Account(
primary_smtp_address=self.username,
config=config,
autodiscover=False,
access_type=DELEGATE,
)print("--------Connected--------")returnaccountdef get_email_list(self, send_time_gte, subject_like=None, sender=None):""":param send