使用python从多个电子邮件前景下载多个附件

时间:2019-11-12 18:46:44

标签: python-3.x outlook download

我正在尝试从多个具有相同主题和发件人的邮件中下载多个附件,但我不知道自己在做错什么,有人可以帮助我吗?

import win32com.client
Outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") #Opens Microsoft Outlook
folder = Outlook.Folders[3] #N4 Invocie folder
subFolder = folder.Folders[5] #N4 Invoice subfolder
subFolderMessages = subFolder.Items #Invoice items object
message = subFolderMessages.GetFirst()
while True:
      subFolderItemAttachments = message.Attachments
      nbrOfAttachmentInMessage = subFolderItemAttachments.Count
      x = 1
      while x <= nbrOfAttachmentInMessage: attachment = subFolderItemAttachments.item(x) 

0 个答案:

没有答案