[英]How to get sender SMTP email address from MailItem in outlook using python?
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.我正在尝试使用 Python 和 win32 获取 MailItem 的发件人 email 地址,但是每当找到 Exchange 地址时,我都无法获取 SMTP 地址。 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)
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 .您可以尝试使用
MailItem.PropertyAccessor.GetProperty
读取PidTagSenderSmtpAddress
MAPI 属性(DASL 名称http://schemas.microsoft.com/mapi/proptag/0x5D01001F
) - 使用OutlookSpy (单击 IMessage 按钮)或MFCMAPI查看消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.