我需要阅读所有的电子邮件从一个特定的地址和获得“一些内容”到excel
我在阅读电子邮件方面取得了一些成功,但我还是要把这些电子邮件的内容输入excel
import win32com.client
import xlsxwriter
import pandas
wb = xlsxwriter.Workbook('Planned_power_outage.xlsx')
ws = wb.add_worksheet()
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI").Folders
folder = outlook(1)
inbox = folder.Folders("Inbox")
messages = inbox.Items
for message in messages:
if (message.SenderEmailAddress) == 'addess here':
sent_date = message.senton.date()
sender = message.Sender
subject = message.Subject
content = message.body
possible_node = subject.split(" ")[1]
print(sender,subject,content)
i expect to see the output as below in a excel file
SENDER SUBJECT CONTENT
alpha this is subject0 blahbalahblahablah
alpha this is subject1 blahbalahblahablah
alpha this is subject2 blahbalahblahablah
目前没有回答
相关问题 更多 >
编程相关推荐