Get the variables from Email

Hi, I need to read the variables from Email Body. It looks like this:

Name:Tom
Surname:Smith
Location:New York
Age:34

How to get all of these into variables like string Name will store “Tom”

I think that may be easy but I’m new in IT.

Best Regards,
Logan

@jeyekij306

If you install outlook in your system then use Get Outlook Mail message activity and create a variable for mailmessages

Use ForEach activity to loop and change the typeArgument to system.Net.Mail.MailMessage

Inside the For Each activity place a Assign actvity and write as mailBody = item.Headers(“Body”).ToString

Now use Regex to retrive your information
Example use Assign and write as Name = System.Text.RegularExpressions.Regex.Match(mailBody,“(?<=Name).+”).Value

This will store the name value in the Name variable

like wise you can create multiple variables to store surname, location, age etc.,

Hope this may help you

Thanks

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