Using this library I have been able to get the subject, sender, body, and attachments of all emails in an inbox but I cannot figure out how to get the received dates /sent dates of an email.
messages = client.users[emailremoved].messages.select([“subject”, “body”, “receivedDateTime”]).top(50).get().execute_query()
emails = []
excluded_senders = [*emailremoved*]
for message in messages:
sender_email = message.sender.emailAddress.address
if sender_email not in excluded_senders:
email = {
"Subject": message.subject,
"Sender": f"{message.sender.emailAddress.name} <{sender_email}>",
"Body": parse_html_to_json(message.body.content),
"Attachments": [],
"Date": message.receivedDateTime,
}
and here is my error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-cf36cf3304fd> in <module>
39 "Body": parse_html_to_json(message.body.content),
40 "Attachments": [],
---> 41 "Date": message.receivedDateTime,
42
43 }
AttributeError: 'Message' object has no attribute 'receivedDateTime'
New contributor
geno8771 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.