How to Filter with Domain in Get Outlook Mail Message activity?

My requirement is I want to read email only by specific email id e.g. If there are 20 Unread emails and say out of which 4 are then BOT should only read those 4 emails.

Please help me on this.

Thank you.

to check from which email address message has been sent, robot has to get that email firstly.
But in ‘for each’ activity you can use ‘if’ statement and check the sender → message.From.ToString
and with these messages you can do something later



Thanks for your reply but I want to filter emails before reading. Is it possible ?

We have filter options in Get Outlook Mail message activity so I want such filter code which will filter based on domain.

Try to use:
“[sendername]=‘Name of sender”
“[senderemailaddress] = ‘’”
maybe this video will help you:


Hi @Rahul_More1

Try out the below expression in Outlook!

“@SQL= (urn:schemas:httpmail:sendername like ‘’)”


I think I found the solution in the different topic.
So I used for sender email address this filter:
“@SQL=”+Chr(34)+“http ://”+Chr(34)+" like ‘’"
and it’s works well.
I found this solution here:



Thanks for your reply.

I tried this but actually it’s not filtering.

In my mailbox I kept 5 unread emails and out of which two are Gmail domain, it should give me Two as an count but it is giving five count.

But did you get 5 last emails from domain ?
Since you are using a filter, it will skip all other messages (from different domains then gmail).
I don’t see any issue with using this filter expression :roll_eyes:



I mentioned earlier that there are 5 unread emails, out of which two are and other three are

I used code sent by you and put condition for, so generally it should give me count as TWO and rest emails i.e. those should be in Unread condition but I am getting count as FIVE and all emails are getting read which unexpected.

Filtering doesn’t work that way.
If you want 2 unread message from gmail and you will use filter you will get 2 unread emails only from gmail (the order doesn’t matter and all emails from another domains will be skipped).
If you mark 5 you will get 5 unread and they will all be from gmail.


You can try from your end. Take 6 emails 3 from and 3 from Keep all emails as Unread, then run your BOT keeping any one domain in filter condition.

Let me know the result :slightly_smiling_face:

I am sure that it will give you count as 6 instead of 3.

So, filtering is the bad way for you. It works well but it works like the where clause. This is reason why you get all messages from gmail.
So, summarize to get the results which you want you need to get the messages without filtering, then check the sender’s domain in the if condition and mark the message as read.