RPA flow to read the list of emails and copy the content into a .txt file
Create an RPA flow to read the list of mails in your mailbox and copy the contents in a .txt file.
Pre-requisites for flow creation
To create this RPA flow, you must ensure to:
- Create a folder to store the .txt file where the mail body is copied. For example, “C:\RPA”
- Create a .txt file within this folder, For example, “C:\RPA\rpa.txt”
Creating a flow
This section lists the steps required to create an RPA flow for reading a list of emails and copying the content to a .txt file.
- Log on to the RPA Studio application. The home page is displayed.
- Click . The New Project screen is displayed.
- Specify the basic information related to the new project.
- Click . The canvas to design the workflow is displayed with the Project menu open by default.
- Select the project file to display the Sequence window for creating an RPA flow.
- Click to open the Activities panel.
- Add the ( activity to the canvas.
- Specify this information in the Properties panel on the right side of the
screen:
- Account
- Your mail address from which the bot must read the mails. For example, adam.smith@infor.com. You can also create a variable of ‘String’ type with a default value.
- MailFolder
- The name of the folder within the mail account. For example, test. You can also create a variable of ‘String’ type with a default value.
- Filter
- The properties based on which the e-mails must be filtered. For example, “[Subject] = test”. See Filters for more information.
- Mark as Read
- Select this check box if the email must be marked as Read in your email box.
- Only Unread E-mails
- Select this check box to open only those emails that were not read previously.
- Top Number of Emails
- The maximum number of emails to consider. For example, 2.
- Emails
- Create a variable System.Collections.Generic -> List <T>. Select Infor.Activities.Email.Mail for the T value.
- Add the ( ) activity to the canvas.
- Specify this information in the Properties panel on the right side of the
screen:
- Type Arguments
- Select Mail (Infor.Activities.Email.Mail)
- Values
- Create a variable. For example, emaillist. Items in the list of the mails stored in this variable are considered.
- Add the ( ) activity to specify the flow for reading each mail body and writing to the file.
- Add ( ) in the activity to assign the mail body to a variable of String type.
- Specify this information in the Properties panel on the right side of the
screen:
- To
- Create a variable of String type. For example, body. The text of an email is stored in this variable.
- Value
- Specify a VB expression for reading the mail body and transforming the text to string data type. For example, item.body.tostring.
- Add the ( ) activity.
- Specify this information in the Properties panel on the right side of the
screen:
- Line
- Create a variable to store the body of the email.
- Source Filepath
- Specify the location where the .txt file must be stored. For example, C:\RPA\rpa.txt. You can also create a variable of the String type with default values.
- Add the ( ) activity to download attachments, if any.
- Specify this information in the Properties panel on the right side of the
screen:
- Specify Item. Item is a single mail within the mail list.
- Path
- The location where the attachment must be stored.
- File Path
- Create a variable to store the list of paths(locations) where the attachments are downloaded.