How to extract mailbody 1 line by time

Hello i have an robot where i want to extract each line in a mail.
The mail will always contains 3 fields under eachother. Want to assign a variable to each line

1 Like

Hi @langsem ,

Can you be more detail of your query, so that it would be easy to build the logic and what are the values mean?


If you configured your outlook in you system, then use Get Outlook Message activity, This will read all your message and store into a variable

Now use For Each activity->Change Type Arguments to System.Net.Mail.MailMessages
Insidethe For Each place Assign activity

Declare a String variable and write as item.headers(“Body”).ToString.Split(Environment.NewLine.ToArray ,StringSplitOptions.RemoveEmptyEntries)

After that you can use Index like

String Variable (0) will give you 1st value

Hope this may help you


1 Like

Solid answer, however I would recommend using


Happy Automating


Hello @langsem ,

You can read the email using the get outlook message activity, then assign your mail body as an string of array.

Then assign the first value variable as mail body(0).tostring likewise you can do for other lines.

Hope it will work for u. If you need a reference please find the attached workflow.
Email body.xaml (10.3 KB)

Venkatesh. R

Thanks this was very helpfull :smiley:


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