I have my outlook mailboxes in this structure
mailbox1
-Inbox
Mailbox2
-Inbox
Current script is able to access Inbox of mailbox1 as it is my main mail box where as mailbox2 has been added into my profile. I want to be able to access Inbox of Mailbox2
import win32com.client
import pythoncom
import re
class Handler_Class(object):
def OnNewMailEx(self, receivedItemsIDs):
# RecrivedItemIDs is a collection of mail IDs separated by a ",".
for ID in receivedItemsIDs.split(","):
mail = outlook.Session.GetItemFromID(ID)
subject = mail.Subject
outlook = win32com.client.DispatchWithEvents("Outlook.Application", Handler_Class)
#and then an infinit loop that waits from events.
pythoncom.PumpMessages()
The above script is accessing mailbox1 Inbox.
Is there any way to access inbox of maillbox2?