I'm trying to write a program that finds my e-mails. I'm having trouble writing a function that would return the sender's email address. Whatever type of message it is.I find function:
def return_sender(msg): if msg.Class == 43 if msg.SenderEmailType == "EX": if msg.Sender.GetExchangeUser() != None: return msg.Sender.GetExchangeUser().PrimarySmtpAddress else: return msg.Sender.GetExchangeDistributionList().PrimarySmtpAddress else: return msg.SenderEmailAddress
Class 43 is MailItem, but for example how to get the sender's address from class 53 = MeetingItem?
msg.Sender
It returns AttributeError.
msg.SenderEmailAddress
It returns:
/O=EXCHANGELABS/OU=EXCHANGEADMINISTRATIVEGROUP(FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=6F467C825619482293F429C0BDE6F1DB-
Is there any way to get the sender from a message type other than MailItem? And how you can check outlook what type of message isThank you