Check for multiple subject lines in email

I wanted to check if the subject line from the email contains string from the ff. keyword

keywords = {“Cash”, “Receipts”}

Is there some cleaner implementation where in I can check if the email subject contains any word from the keywords array of strings


String methods are cumulative from the left, have you tried?


In theory mailMessage.Subject.Contains(“Cash”).Contains(“Receipts”) without the extra parenthesis should also work, however in practice I have found some object expectations not properly accounting for multiple methods for which the added parenthesis help.

what I did is this , I have an array of keywords which for example contains keywords = {“Cash”, “Receipts”} and then I use assign isContains = keywords.Any(function(x)mailMessage.Subject.Contains(x))

Beautiful, thanks for sharing, I learned something by replying to your question. :grinning:

1 Like

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