Skip to content
Advertisement

Timestamp of Outlook emails using Python

Is it possible to use Python to extract timestamps from received email? I’m using the following code but to no avail:

messages = ap.Items
message = messages.GetNext()
receipt = message.ReceivedTime.date()  

for i in messages:
    print(receipt)

I only get one date published repeatedly for each email. (i.e., 2021-11-22, 2021-11-22, 2021-11-22…….)

Any help will be much appreciated.

Advertisement

Answer

Well, of course – you only retrieve ReceivedTime once:

for i in messages:
    print(i.ReceivedTime.date())
Advertisement