0
提取收件人的名字,我試圖提取收件人地址,我得到下面的時候我打印:無法在Outlook電子郵件的Python
<COMObject <unknown>>
我有下面的代碼。我也試過Receipient.Name
。
import win32com.client
import sys
import csv
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6)
messages = inbox.Items
message = messages.GetLast()
subject_list = []
sender_list = []
recipients_list = []
i = 0
while message:
subject = message.Subject
sender = message.SenderName
recipients = message.Recipients
subject_list.append(str(subject))
sender_list.append(str(sender))
recipients_list.append(recipients)
i+=1
message = messages.GetPrevious()
if i > 10:
break
for subject in subject_list:
print(subject)
for sender in sender_list:
print(sender)
for recipient in recipients_list:
print(recipient)
如何獲取收件人姓名或電子郵件地址?