[英]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.