保存Outlook消息文件(.msg),包括Python中的附件?

发布于 2025-02-11 05:05:25 字数 313 浏览 3 评论 0原文

我需要在Python的Msg-File中保存Outlook-Mails。当前使用win32com.client i使用:message.saveas(path + name),它为我提供了一个不错的.msg文件,但不包括附件(如果附件存在,则)。使用message.attachments.countmessage.attachments.attachments可见附件的文件,但是如何创建一个.msg-file,其中包含的附件​​包含的附件​​作为一个文件当消息直接从Outlook出口时?

I need to save Outlook-Mails with the attachments in the msg-file in Python. Currently working with win32com.client I use: message.SaveAs(path + name) which gives me a nice .msg file, but that does not include attachments (if attachments existent). Attached files are visible using message.Attachments.Count and message.Attachments, but how can I create a .msg-file with the attachments included to store as one file which works when messages are exported straight from Outlook?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

左秋 2025-02-18 05:05:25

如何创建一个.msg文件,其中包含的附件​​作为一个文件作为一个文件,当消息直接从Outlook导出时可以使用?

Outlook对象模型不能为此提供任何内容。可能,您能做的最好的是保存附件的文件以及您的邮件项目(MSG)。使用 attachment.stactment.saveasfile.saveasfile 可以节省的方法指定路径的附件。

how can I create a .msg-file with the attachments included to store as one file which works when messages are exported straight from Outlook?

The Outlook object model doesn't provide anything for that. Potentially, the best that you could do, is save the attached files along with your mail items (msg). Use the Attachment.SaveAsFile method which saves the attachment to the specified path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文