email - How to save attachment from outlook using win32com ...
stackoverflow.com › questions › 22399835Im trying to read email and download the attachment to my own folder using win32com module in Python, I stopped at getting the attachment object: from win32com.client import Dispatch import datetime as date outlook = Dispatch ("Outlook.Application").GetNamespace ("MAPI") inbox = outlook.GetDefaultFolder ("6") all_inbox = inbox.Items val_date = date.date.today () sub_today = 'Hi' att_today = 'Attachment.xlsx' for msg in all_inbox: if msg.Subject == sub_today: break for att in msg.
email - How to download outlook attachment from Python Script ...
stackoverflow.com › questions › 39656433Apr 02, 2020 · import datetime import os import win32com.client path = os.path.expanduser("~/Desktop/Attachments") today = datetime.date.today() outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") inbox = outlook.GetDefaultFolder(6) messages = inbox.Items def saveattachemnts(subject): for message in messages: if message.Subject == subject and message.Unread or message.Senton.date() == today: # body_content = message.body attachments = message.Attachments attachment = attachments ...