How to extract word from mail subject and then save attachment with that name

Hello guys!!! I need you.

I have the following situation:

I receive every day 100 excel table from 100 city accounts.
Each of them writes in the subject the name of the city they are responsible for, but the other words are free.

subjects examples
mail 1) New York report
mail 2) Daily Report Los Angeles
mail 3) 15.03.2017 Boston report

mail 100) Miami file 15.03.2017

All the possible cities are fixed and I have a list of those cities in excel (even if sometimes they can write them differently…e.g. New - York or New York)

Anyway, I need to extract the name of the city from the subject and then save the mail attachment with the name of that city mentioned in the subject.

All the reports are saved in a folder named “Today” and everyday the single city report has to be replaced with the new one received by mail.

Who does have any idea?

Thank youuuuu


Lets name this as listOfCities and it contains (for eg.) (“New - York”,“Miami”,“Los Angeles”)

store mail subject as strMailSubject

Use the following query to get a strOutputCityName that has been received after the comparison of listOfCities and strMailSubject

In Assign activity, (Note: Import the namespace System.Text.RegularExpressions)

String strOutputCityName = String.Join("",(From item in listOfCities where Regex.Replace(strMailSubject.ToLower,"[^a-z]","").Contains(Regex.Replace(item.ToLower,"[^a-z]","")) Select item))

Dom :slight_smile: