I'm trying to use ExchangeLib to return all emails within an inbox within the past 24 hours. I currently have it set up to return the most recent email in the inbox, I just need help with the 24 hours part. Here is what I have so far:
credentials = Credentials('My@email', 'password')
account = Account('My@email', credentials=credentials, autodiscover=True)
for item in account.inbox.all().order_by('-datetime_received')[:1]:
print(item.subject, item.sender.email_address)
html = item.unique_body
soup = BeautifulSoup(html, "html.parser")
for span in soup.find_all('font'):
return(item.subject, item.sender.email_address, span.text)
I've been trying to look up references on how to go about this, but I'm honestly not finding much. Any recommendations?