Detect if a particular email ID has automatic replies set in Outlook using python win32com library

19 Views Asked by At

i am trying to detect if a particular email ID in Outlook has set Automatic reply and fetch the Automatic reply text.

Can someone help me with finding automatic reply status & content?

I got the Exchange object for an email ID but was unable to check if they have auto reply status & content

import pythoncom
import win32com.client as win32


def get_outlook_instance():
    # Initialize the COM library
    pythoncom.CoInitialize()

    olApp = win32.Dispatch("Outlook.Application")
    # MAPI stands for "Message Application Programming Interface"
    olNS = olApp.GetNameSpace("MAPI")

    return olApp, olNS


def get_address_object_from_email_id(email_id):
    outlook_application, outlook_namespace = get_outlook_instance()
    address_entry = outlook_namespace.CreateRecipient(email_id)
    return address_entry

email_address = "[email protected]"
recipient = get_address_object_from_email_id(email_address)

# Resolve the recipient's name to get the corresponding ExchangeUser object
exchange_user = recipient.AddressEntry.GetExchangeUser()
0

There are 0 best solutions below