I am trying to read emails received from specific email addresses (more than 1). For single use case, the following code seems to be working -
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6)
messages = inbox.Items.Restrict("[SenderEmailAddress] = '[email protected]' ")
For providing multiple email ID as a filter I tried the following two approaches but that does not work -
messages = inbox.Items.Restrict("[SenderEmailAddress] = '[email protected]; [email protected]' ")
messages = inbox.Items.Restrict("[SenderEmailAddress] In ['[email protected]', '[email protected]'] ")
How can I provide multiple filter values like in this scenario?
You need to include multiple conditions using the
ORoperator: