1

At the moment I am using the below code to listen to incoming messages in Outlook from Python.

How can I do the same for Outgoing messages from my Outlook?

import win32com.client
import pythoncom

class Handler_Class(object):

senders = ['blabla@gmail.com']

def OnNewMailEx(self, receivedItemsIDs):
    # RecrivedItemIDs is a collection of mail IDs separated by a ",".
    # You know, sometimes more than 1 mail is received at the same moment.

    for ID in receivedItemsIDs.split(","):
        mail = outlook.Session.GetItemFromID(ID)
        subject = mail.Subject



outlook = win32com.client.DispatchWithEvents("Outlook.Application",Handler_Class)

# an infinite loop that waits for event
pythoncom.PumpMessages()
toniggg
  • 87
  • 8
  • Found something about reaching the [Sent Items folder](https://stackoverflow.com/a/39911751/9094687), might be of some use. – Shakes Jun 28 '18 at 16:52

0 Answers0