I have 2 mailboxes (abc@er.com and def@er.com) in outlook and need to connect to a specific mailbox. By default, Python's win32com.client is connecting to the wrong one.
Is there a parameter to specify which mailbox to connect to? My code is:
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6)
messages = inbox.Items
I have tried very hard to find which parameters allow me to connect to a specific mailbox but did not see anything. Thanks for your help.
You should be able to enumerate the mailboxes with:
for folder in outlook.Folders:
print(folder.Name)