RPA UiPath

Email Automation with Studio (UiRPA part 18)

Email Automation with Studio

About the course

In this course, we will explore how working with email can become fast and reliable with the use of UiPath Studio and email-related activities.

Keep your inbox open and get ready to see the tasks that can be automated in order to save valuable time.

What you will learn in this course

At the end of this course, you should be able to:

  • Install the dedicated email activities in UiPath Studio.
  • Retrieve email messages based on the email client and server in use.
  • Automate the interaction with emails by filtering and downloading attachments.
  • Use the different ‘Send Email’ activities available.
  • Use message templates to send emails.

The UiPath Mail Activities Pack

This activity package is designed to facilitate the automation of any mail-related tasks, covering various protocols, such as IMAP, POP3 or SMTP. UiPath also features activities that are specialized in working with Outlook and Exchange.

To better understand the usability of the mail activities in the package, let’s take a high-level look at how we can automate the distribution of email alerts generated by multiple servers.

Filtering Emails

In the Mail Activities Package, there are two main ways to filter emails:

  • By using control flow activities.
  • By using ‘Get Outlook Mail Messages’ activity.

The filtering options provided with ‘Get Outlook Mail Messages’ are:


A string used as a filter for the messages to be retrieved. Accepts JET queries or DASL queries.

Let’s assume that you use Outlook and need to retrieve only the email messages that have “Critical” in the beginning of the subject line. 

In this case, you can also use SQL filtering, and your expression would look like this:

@SQL=””urn:schemas:httpmail:subject”” like ‘Critical%‘”


Returns only mail messages that match the specified message IDs. If set, the Filter option is ignored.


Specifies whether to retrieve only unread messages. By default, this check box is selected.


The number of messages to be retrieved starting from either the newest or the oldest, depending on the OrderByDate parameter.

Aside from the filtering options provided by the ‘Get Outlook Mail Messages’ activity, you can also use a For Each activity to indicate the actions to be taken based on the specified conditions.

  • Emails can be used as the input to or the output of a process.  
  • Email activities are contained inside the UiPath.Mail.Activities pack.  
  • By default, the pack provides specific activities for Exchange, IBM Notes, IMAP, Outlook, POP3 and SMTP.  
  • The object type we use for retrieved emails is System.Net.Mail.MailMessage.  
  • When building a process which uses email, for most activity groups, some configuration may be required on the email account. 

Sending Emails

Send SMTP Mail Message activity.

Send Outlook Mail Message activity.

System.Net.Mail.MailMessage‘ represents the main data type when working with emails in UiPath. You will be using this data type whenever you need to get or forward email messages.

When sending an email using one of the email activities in Studio, you can add a subject, custom body, and attachments, or even use a template to do all these. You can also use an Orchestrator Asset or the ‘Read Text File‘ activity to access a template.

Sending emails SMTP

  • When automating the process of sending single attachment emails, we need to create an in argument that stores the path of the file in the Attachments section of the Send SMTP Mail Message activity.
  • When automating the process of sending multiple attachments, we need to use a For Each File in Folder activity along with a Add To Collection activity to iterate through each file that we specify in a folder. In our case, we configured a filter that only attaches png files from the data folder.  

Sending emails Outlook

  • To create a template, we must write the message in a new text document and then use a ‘Read Text’ activity to read it.  
  • To store the template text, we must create a new variable in the ‘Output to’ property field.  
  • To attach a screenshot to an email, we need to use a ‘Take Screenshot’ activity and then store the outcome as a variable.   
  • The ‘Send Outlook Mail Message’ activity sends an email message from Outlook.  


In the Mail Activities Packages, what are the activities which contain built-in filtering?


  • Get Outlook MailMessages
  • Get Exchange MailMessages
  • Get IMAP Mail Messages

The location from where we can retrieve the messages

Answer: Mail Folder

What activity can you use to send an email without entering the username and password of the email account?

Answer: Send Outlook Mail Message

Which of the following properties are found in the Get Outlook Mail Messages activity?

Answer: MailFolder

The Send Outlook Mail Message activity will work without having Microsoft Outlook installed.

Answer: False

You are using the ‘Save Attachments’ activity and you have specified a local folder to download the files. What will happen if there are duplicate file names in the folder?

Answer: The old files will automatically be overwritten. 

What is the supported variable type in the Output property field of all Get Mail activities (POP3, IMAP, Outlook, Exchange)?

Answer: List (MailMessage)


Diploma of completion
Diploma of completion