I am working on a script that reads emails from Outlook using Python, I wanted to know if there is any way to read the attachments without downloading them, for example open an attached pdf and capture it in a DataFrame.
This is my code:
import win32com.client
import os
mail ='email_name@gmail.com'
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
stores = outlook.Stores
for store in stores:
if store.DisplayName == mail:
inbox = store.GetDefaultFolder(6)
messages = inbox.Items
for attachment in messages[1].Attachments:
print(attachment)