将Outlook电子邮件主体提取到CSV中
您好,我每天收到此电子邮件,并试图自动执行此任务。
这是电子邮件主体的一个示例,我不确定其格式是什么。
电子邮件主体:
。
我的目标是将所有行放入CSV文件中。然后,我可以将文本分开,但我不确定如何将其变成CSV。
import win32com.client
import pandas as pd
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6).Folders.Item("Automation")
Mail_Messages = inbox.Items
message = messages.GetLast()
body_content = mail.Body
print(body_content)
这也是我要获得的当前输出。可以忽略外部电子邮件警告吗?
Hello I receive this email daily and trying to automate this task.
Here is an example of the email body, I'm not sure what's the format of it.
Email body:
.
My goal here is to get all the rows into a CSV file. Then I can split the text but I'm not sure how to turn it into a CSV.
import win32com.client
import pandas as pd
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6).Folders.Item("Automation")
Mail_Messages = inbox.Items
message = messages.GetLast()
body_content = mail.Body
print(body_content)
Also here is the current output I'm getting. Would it be possible to ignore the External Email warning?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用字符串函数获取
chrexternaltag
子字符串之后开始的子字符串。例如,在Python中,您可以使用 split 函数。You can use string functions to get a substring which starts after the
chrexternaltag
substring. For example, in Python you could use the Split function.