How to extract text dynamically from mail body

I want to extract data from mail body which is under “note” keyword and content can be in list format and how to make it dynamically for all mails.

Thanks in advance please help me


Hi @Reeba_Raju

Use get outlook mail message activity and regex expressions to dynamically extract the data.


Download the emails in .mht format and the use the for each file in folder.

Use the application or browser and pass the CurrentFile into that so that particular mail will be opened and the use the matches activity to extract the required data (214.0 KB)
The above uploaded is the sample xaml. for downloading and other activities and if you can share the sample input i will help you with the regex xaml too.



Use get outlook mail messages

Take for each email
Take if condition:


Hi @Reeba_Raju

=> Use Get outlook message activity to get the mails from the outlook.
=> Use for each to iterate the mails and give the current Item in Save mail message activity.
=> You can save the mail by using save mail message activity as .mht file.
=> After that you can use that .mht file in Use application\browser activity to open on the screen.
=> Then you can use the Get text activity to get the required text from the mail body.


=> Use Get outlook Mail message activity to get the mails from the Outlook
=> Use for each to iterate the mails.
=> Take an assign activity and store the Mail body in a string variable
- Assign → StrVar = CurrentItem.Body (which stores the mail body in the variable).
=> Use data manipulations or regular expressions to get the Required data.

Hope it helps!!

Hi @Reeba_Raju

Use Get IMAP Mail Messages" or “Get Outlook Mail Messages” to read the email and get the body content.
Use Regex for example

Hope it helps!!

Hi @Reeba_Raju

Welcome to Community!!

Try this

First extract the body from mail after that use regex to extract the data.

I hope it helps!!

I have used 2nd method, and used get text activity to extract data after “note” Keyword but the issue I am facing is that it is not dynamically extracting the data, it is printing same data(first data) over and over again


Use fuzzy selector instead of strict selector.


Try this

Okay @Reeba_Raju

=> Got it. Open the properties of Get text activity.
=> Open the Strict selectors for target option, copy the selectors.
=> Open the Fuzzy selectors option, delete the fuzzy selectors and paste the strict selectors that you have copied.
=> In Targeting methods option check the fuzzy selectors and uncheck the strict selector and computer vision.

We have changed the strict to dynamic then it will extract properly.

Hope it helps!!

Tried this one but not understanding how to extract data using regex part.

Send the sample text file we will write the regex code for this

Now I am facing issue like I have to manually change mails to extract data using get text activity can you please help me do it by automation.

Could you please elobarate more your question then It will better understanding to me. @Reeba_Raju

I have to manually change the mails in outlook so that it can extract data which is visible in he screen, otherwise it is extracting only one data again and again.

Could you show me your code. @Reeba_Raju

Are you using the For each to iterate the mails.

Did you give the below properties for Use application\browser activity.
Close → Always
Open → If Not open

Send me the full workflow it was not understandable for me. Where is the Use application\browser activity and all. @Reeba_Raju

Main.xaml (23.1 KB)