Filter Outlook mails based on From address

How can use Filter property to filter email messages from different domains in ‘Get Outlook Mail Messages’ activity

first get the outlook mails using get outlook mail message then write it in a data table use filter data table actiivity to filter it or u want a different filter activity

Use mail.sender.address.tostring

@krishnakanth.k
You need to use the Output Variable of Get Outlook Mail Messages, which is a List of MailMessages
Iterate that List Keeping the Type Argument of For Each as MailMessage
Then Use an If Condition in For Each, Use the Condition in If as item.Sender.Address.ToString.Contains(yourValue)

Since you need to Filter with Address

@Jebarohith19 @supermanPunch @karthick

can we not use Filter property in Get Outlook Mail Message…?

If you use filter property , Mails from filtered address only be retrieved.

If you use as above in looping logic, You can filter multiple address and can be reused .

You can filter emails once after you get all mails… But inside get mail message activities you can’t use filter…

I want to read mails only from specific domain… is it possible using filter property

The filter is most likely the equivalent of using the “Search Current Mailbox” feature in the Outlook application. Whatever string you write into it will apply the rules of this search feature.

from:@discoursemail.com is working good in outlook application.

But the same is not working in ‘Get Outlook Mail Messages’ activity

@krishnakanth.k Where have you specified the filter in Get Outlook Mail Messages Activity?

I’ve highlighted them in the screenshot.

@krishnakanth.k Have you tried Just @discoursemail.com AS Filter ?

tried, but no luck. it’s not reading any mails

Use filter query like this

@SQL”+Chr(34)+“urn:schemas:httpmail:fromemail”+Chr(34)+“like ‘%[@discoursemail.com]'"

1 Like

@krishnakanth.k Try this :
In Assign Activity :
Messages = Messages.Where(Function(x)x.Sender.Address.ToString.ToLower.Contains(“@discoursemail.com”)).ToList

This should only keep the mails which has discoursemail.com as the address in it

@supermanPunch
Thanks Mate. Appreciate your help.

1 Like

Thanks everybody for your valuable responses.

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