IMAP mail message filter expression

How I will use filter expression in IMAP mail message for getting emails from two email ids. Either email 1 or email 2?

Hi @Amit_Kumar_Charde

Try the below filter expression in the Get IMAP Mail Message activity,

"[SenderEmailAddress] = 'Manish@Microsoft.com' Or [SenderEmailAddress] = 'Anil@gmail.com'"

Hope it helps!!

Hi @Amit_Kumar_Charde

=> Use Get IMAP Mail Messages to read the emails and store the output in a variable say imapMailMessages.

=> Use the below syntax in Assign activity:

filteredEmails = imapMailMessages.Where(Function(mail) mail.From.Address = "email1@example.com" Or mail.From.Address = "email2@example.com").ToList()

filteredEmails is a variable of type List(Of System.Net.Mail.MailMessage).

=> After that use For Each loop to iterate through filteredEmails and proceed with your further process.

Hope it helps!!

And Docu:

Where we get the following hint:

@mkankatala getting this error message while using the filter expression you mentioned “Get IMAP Mail Messages: The IMAP server replied to the ‘SEARCH’ command with a ‘BAD’ response: Could not parse command”

we encourage to filter on the source. So we would focus on IMAP Filter instead of post Filtering with a LINQ

for the IMAP Filter syntax we shared the hints and docu with you

Had you tried on the first round a single FROM filter?
Once this is working you can continue and try the OR to combine both filters

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.