0
class Handler_Class():
def OnItemAdd(self, mail):
#Check if the item is of the MailItem type
if mail.Class==43:
print(mail.Subject, " - ", mail.Parent.FolderPath)
inboxes = ["inbox1", "inbox2"]
for inbox in inboxes:
items = win32com.client.DispatchEx("Outlook.Application").GetNamespace("MAPI").Folders[inbox].Folders["Inbox"].Items
win32com.client.DispatchWithEvents(items, Handler_Class)
print(datetime.now(),"Ready to pump")
pythoncom.PumpMessages()
pythoncom.PumpMessages() 그래도 작동하지 않습니다. 하나의받은 편지함 항목 만 수신하도록 코드를 리팩터링하면 작동합니다.
해결 방법에 대한 아이디어가 있으십니까?