Email filter won't identify specific sender

Hey,

I am running a ‘for each’ loop to check and move emails matching a certain criteria. I can’t seem to get the ‘if’ activity to work on identifying specific senders.

So part of my criteria is not working is:
Or email.From.ToString.Equals(in_Config(“Identifier1”).ToString) and email.Body.Contains(in_Config(“Identifier2”).ToString)

Identifier1 is the specific email address and identifier2 is some generic reoccurring text in the body. If I remove the sender identifier, it works, but I want to include that too for better stability.

I’ve sent the email from my address (which is identifier1) and the contents has the required identifier2 text but it can’t find it. I’ve also tried without the ToString and also tried ‘contains’ instead of equals, but no luck.

Am I doing something wrong here? Thanks.

@dr1992

Can you please print the below two values separately and share the screenshot of it.

           email.From.ToString

           in_Config(“Identifier1”).ToString

@dr1992 Also, give a try to Trim the string values

email.From.ToString.Trim.Equals(in_Config(“Identifier1”).ToString.Trim)