Reading Body of an Email

Hi team,

I have a requirement of reading alert emails using Automation Studio which status of the Alert is in the body of the Email. I am able to read and save the Email. Can you suggest a better way to read the text and get the field in the body of an Email.

Thanks in Advance.



Only way is to use Read Email activity and store the mail content (body and subject ) in a user specified folder. Post that text has to be parsed from txt files saved


I tried file operations and open file, but its opening file in notepad. Is there any way to parse txt file.


Open file activity will only open the file and not read the contents of the file.

Alternatively you can use File handling commands to read text from txt file. I am giving you an exapmle how you can do the same in Studio to read a text file having single line

Create three arguments:

fileP - String (Type) - Argument where my path exist
FileReader - System.IO.StreamReader (Type) - TO read my file
Str- String(Type) - To store thre read content

Use a Assign actiivty and assign
FileReader = System.IO.File.OpenText(fileP)

Use a Assign actiivty and assign
Str = FileReader.ReadLine()

Post that you can use this Str variable as per your use case. In my exapmle i have simple written it in out put console. You can also write more complex logic to iterate through each line of text file using loop

1 Like

Thansk Amit. I will try this. By the way my Email contains a Table.

Hi @amit_anand15

I have implemented my requirement. But How to Dispose opened StreamReader(It is throwing error sometimes).

I have tried FileReader.Close() in Assign. But as its return type is null it is showing me compilation Error.(Tried Adding a string after FileReader.Close(), again shows compilation Error.)

Can you please help me in this.

Hi Sandeep,

For methods which are not returning anything it is not possible to use Assign activity as it expects some value assigned to some argument.

In case Close environment is not fulfilling your purpose and FileReader objects are getting piled up then best option is to use Microbot or Code Editor and dispose the object programatically.

You can refer AssistEdge-CE-CustomizationGuide.pdf for more details


1 Like