How to get IMAP mail messages filtering mail subject using variables?


I have this scenario where I am trying to retrieve mail message using GET IMAP MAIL MESSAGE activity and in the filters, I am using filter for the subject with multiple variables (str_City and str_Email) with “OR” operator. But I am unable to get the desired result, requesting the community members to help me out.

Thank you.

welcome to the community

can you try this way

or explain what you want to filter


Welcome to the community

Try this

"OR (SUBJECT """ + str_State + """) (SUBJECT """ + str_City + """)"


Hi Shiva,

Thank you for the response but this is not what I am trying.

I am trying to use filter in the Get IMAP mail message activity itself so that the activity only retrieves mail if it matches either CITY or EMAIL which will be mentioned in the subject.


Can please share the filter condition which you have mentioned in the filter properties

Hi Anil,

Thank you for the response. I tried your suggestion but it did not work, I received an error

Get IMAP Mail Messages: The IMAP server replied to the ‘SEARCH’ command with a ‘NO’ response: infeasible query (Failure)



Condition: “OR (SUBJECT “”” + str_Email + “”“) (SUBJECT “”” + str_City + “”“)”


“@SQL=urn:schemas:httpmail:subject LIKE '%”+str_Filter+“%'” → strFilter is your variable
Please try this


Can you please check the variables your are passing and the subject is in the correct format

“OR (SUBJECT '” + str_Email + “') (SUBJECT '” + str_City + “')”

Hi Shiva,

I received the same error as mentioned in the reply to Anil.