[英]Read outlook 365 email using python and get sender email (exchange or SMTP)
[英]How to get sender SMTP email address from MailItem in outlook using python?
我正在尝试使用 Python 和 win32 获取 MailItem 的发件人 email 地址,但是每当找到 Exchange 地址时,我都无法获取 SMTP 地址。 我尝试了网上可用的所有内容,但它返回一个空字符串。 这是我正在使用的代码片段:
if msg.Class == 43:
if msg.SenderEmailType == 'EX':
print(msg.Sender.GetExchangeUser().PrimarySmtpAddress)
else:
print(msg.SenderEmailAddress)
您可以尝试使用MailItem.PropertyAccessor.GetProperty
读取PidTagSenderSmtpAddress
MAPI 属性(DASL 名称http://schemas.microsoft.com/mapi/proptag/0x5D01001F
) - 使用OutlookSpy (单击 IMessage 按钮)或MFCMAPI查看消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.