Email Filter For Negetive Cases

Hello Everyone,

I am looking for a solution as filter seems to be not working for me.

Scenario : We are sending email to multiple user with some subject say( 13112021).

Bot will read the reply basis subject however if one of the user has set up Automatic reply in that case bot needs to skip that email, Same way if email is incorrect and failure message will come up , then bot needs to skip that as well

For Automatic reply Subject becomes : Automatic reply: 13112021
For Undelivered emails subject becomes : Undelivered: 13112021
For Normal Email subject becomes : RE: 13112021

I want to filter email and read only the normal emails.

Please suggest filter option if possible instead of looping through all the emails

1 Like

If this is there in all NORMAL MAILS then the below steps would help you resolve this

  1. Use GET OUTLOOK or any GET MAIL activity and get the output as out_mailmessage

  2. Now use a FOR EACH activity and pass the above variable out_mailmessage as input and change the type argument ad System.Net.Mail.Mailmessage

  3. Inside the loop use a IF condition like this

item.Subject.ToString.ToUpper.StartsWith(“RE:”)

  1. If true it goes to THEN block or goes to ELSE block where we can have our required activities to proceed further

Or

To have it in the filter of activity itself
Use this if it’s outlook or use the above one itself

“@SQL=urn:schemas:httpmail:subject LIKE ‘%RE:%’ “

Cheers @aashishchauhan

@Palaniyappan :
Thank you so much for your response

Being specific to “@SQL=urn:schemas:httpmail:subject LIKE ‘%RE:%’ “ this solution
I am trying it
“@SQL=urn:schemas:httpmail:subject LIKE ‘RE: ”+subjectIdentifier+“’”
where subjectIdentifier is of string type and contains today’s date.

While debugging i am getting
Capacity : 0
Count : 0
for mail message variable

What i am doing wrong here?

Did we try with the first method
It is very simple and easy

@aashishchauhan

It is easy and i might get the result, i am sure…
but what i am doing wrong here in filtering emails.
By looking at previous post i dont think there is issue with filter.

Try like this

“@SQL=urn:schemas:httpmail:subject like ‘ "&Strinput.ToString& " % ’ “

Where strinput is a string variable and we can concatenate “RE:” in that variable itself

Check this thread for more ideas

@aashishchauhan

Let me try and update you

I have updated my previous comments

Pls have a look on it

@aashishchauhan

"@SQL=urn:schemas:httpmail:subject like ‘ " &strSearchMail.ToString& " % ’ "

No Luck with this, This is showing End of Expression Expected

Not Sure if Something is wrong with " or “

That ‘&’ is not getting accepted i guess