0
votes

I am trying to get the sender email address of MailItem using Python and win32, but whenever Exchange address is found, I am unable to get the SMTP address. I tried everything available on the net, but it is returning an empty string. Here is the code snippet I'm using:

if msg.Class == 43:
    if msg.SenderEmailType == 'EX':
      print(msg.Sender.GetExchangeUser().PrimarySmtpAddress)
    else:
      print(msg.SenderEmailAddress)
1

1 Answers

0
votes

You can try to read PidTagSenderSmtpAddress MAPI property (DASL name http://schemas.microsoft.com/mapi/proptag/0x5D01001F) using MailItem.PropertyAccessor.GetProperty - take a look at the message with OutlookSpy (click IMessage button) or MFCMAPI.