环顾四周,找不到满意的答案。有谁知道如何使用Python从Outlook解析.msg文件?
我试过使用mimetools和email.parser,但没有运气。帮助将不胜感激!
这对我有用:
import win32com.client outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") msg = outlook.OpenSharedItem(r"C:\test_msg.msg") print msg.SenderName print msg.SenderEmailAddress print msg.SentOn print msg.To print msg.CC print msg.BCC print msg.Subject print msg.Body count_attachments = msg.Attachments.Count if count_attachments > 0: for item in range(count_attachments): print msg.Attachments.Item(item + 1).Filename del outlook, msg