I want to get the SenderEmailAddress of all email sent on two specified mail addresses : 123@abc.com and 456@def.com that are in my Outlook Application on my computer, the point is to make a list of all mail senders that will be kept in a csv file.
The architectures of these mailboxes are this way :
123@abc.com
- -> Inbox
&
456@def.com
- -> Inbox
I would like to read the Inbox Folders from the two mailboxes and store the SenderEmailAddress from the two Folders
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6)
I've found that for some people it works to use
inbox = outlook.GetDefaultFolder(6).Folders[1] # To access 123@abc.com Inbox
inbox = outlook.GetDefaultFolder(6).Folders[2] # To access 456@def.com Inbox
But in my case it just gets me inside of the two subfolders that are inside of Inbox and nothing more, I don't have the possibility to access at all to the second mailbox. I have the possibility to detect these Mailboxes by using
for folder in outlook.Folders:
print(folder.Name)
I have no idea how to fix this and finally access to my second mail address, if anyone would be capable to help me on this it would be great.
Thanks !