【问题标题】:Save excel file from outlook mail that is in the message body从邮件正文中的 Outlook 邮件中保存 excel 文件
【发布时间】:2020-10-21 06:43:28
【问题描述】:

如何保存邮件正文中的 Excel 附件,而不是附件通常所在的位置? (在收件人下)

外观示例

什么时候应该是这样的

我正在使用

outlook = win32.Dispatch("Outlook.Application").GetNamespace("MAPI")
        inbox = outlook.GetDefaultFolder(6).Folders.Item("test") #6 = Inbox (without mails from the subfolder)
        messages = inbox.Items
        for item in messages:
                mail=item
                attachments = mail.Attachments
                attachment = attachments.Item(1)
                for attachment in mail.Attachments:
                    attachment.SaveAsFile(os.path.join(rootpath,str(attachment)))

但是会显示一个错误提示我没有附件

请注意,发件人是来自外部的机器人,我无法更改它发送附件的方式

【问题讨论】:

    标签: python outlook win32com


    【解决方案1】:

    仅当您以 RTF 格式撰写邮件时,附件图标才会显示在邮件正文中。

    【讨论】:

      猜你喜欢
      • 2014-04-22
      • 1970-01-01
      • 1970-01-01
      • 2013-04-11
      • 2019-11-24
      • 1970-01-01
      • 2020-10-06
      • 2018-10-05
      • 1970-01-01
      相关资源
      最近更新 更多