Outlook Mail Automation using UiPath : 
Use Case Retrieve / Reply to Mails using Outlook Mail Activities

Outlook Mail Automation using UiPath : Use Case Retrieve / Reply to Mails using Outlook Mail Activities

Introduction

There are lots of ways to communicate. But when it comes to critical processes, email is still at the top of the list for most of the companies.

UiPath is a leading robotic process automation (RPA) tool that enables businesses to automate repetitive tasks, including sending emails. Email automation using UiPath involves creating a workflow that performs actions such as logging into an email account, searching for specific emails, and sending new emails. Studio provides email automation capabilities through the UiPath Mail Activities Pack.

In the previous article we had a dive deep into Outlook Email Automation, one of the protocols facilitated by UiPath Mail Activities Pack.

In this article, we'll explore methods for efficiently managing emails from subfolders, folders, and shared/group mailboxes using Outlook Mail Activities.

 Outlook Email Automation

 UiPath Studio provides integration with Microsoft Outlook, which includes a set of activities to automate email-related tasks in the Outlook application. These activities can greatly simplify email management, allowing you to create customized workflows that automate routine tasks, such as email retrieval, filtering, and response.

Outlook Mail Activities is a powerful tool that allows you to manage your email efficiently. One of the most common challenges with email management is handling emails that are stored in subfolders, folders, or shared/group mailboxes.

There are several methods you can use to efficiently manage emails from subfolders, folders, and shared/group mailboxes using Outlook Mail Activities. Here are some examples:

 1.    Use the "Get Outlook Mail Messages" activity to retrieve emails from specific subfolders, folders, or shared/group mailboxes. Use filters to narrow down the search results and retrieve only the relevant emails.

2.    Use the "Move Outlook Mail Message" activity to move emails from one folder to another or from one mailbox to another.

3.    Use the "Reply to Outlook Mail Message" activity to quickly respond to emails from subfolders, folders, or shared/group mailboxes.

 Let's consider a scenario where we need to:

 1.    Retrieve emails that have specific subject lines.

2.    Organize them into folders and subfolders based on their subjects.

3.    Send all the emails from these folders and subfolders to a designated group.

4.    Retrieve emails from the group and respond to them.

 Prerequire:

 1.    Install the UiPath Studio.

2.    Install the dedicated email activities in UiPath Studio.

No alt text provided for this image

3.    Make sure you are logged in to Outlook.

It is not necessary to have the outlook application open.

 

Scenario:

Step 1A: Retrieve emails from certain send or with specific subject.

Using "Get Outlook Mail Messages" activity.

To retrieve emails from specific subfolders, folders, or shared/group mailboxes, we can make use of the "Get Outlook Mail Messages" activity. This activity offers the flexibility to specify various parameters, such as the mailbox or folder from which to retrieve emails, the number of emails to retrieve, and whether to include unread emails.

No alt text provided for this image

Properties:

Input

MailFolder - The mail folder from which the messages are to be retrieved.

Account - The account used to access the messages that are to be retrieved.

Options

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

Top - The number of messages to be retrieved starting from either the newest or the oldest, depending on the OrderByDate parameter. If this field is empty, the activity returns no messages.

Output

Messages - The retrieved messages as a collection of MailMessage objects.

 First, add it to your workflow in UiPath Studio. Then, configure the activity by specifying the mailbox or folder you want to retrieve emails from and any other parameters you want to use.

No alt text provided for this image

  Step 1B: Retrieve emails that have specific subject lines.

Use filters to narrow down the search results and retrieve only the relevant emails. This is particularly useful when dealing with large volumes of emails or when searching for emails that meet specific criteria. We can use filters based on various criteria such as the sender, subject, date, and attachment presence.

 Filtering Examples

The following table shows examples of filters that can be useful when you query Outlook mail messages:

No alt text provided for this image

In our case we can use filters based on the subject like,

 1.    "@SQL=""urn:schemas:httpmail:subject"" like '%Sample Mail - Folder' AND @SQL=""urn:schemas:httpmail:subject"" like '%Sample Mail - Sub Folder' "

2.    "@SQL=""urn:schemas:httpmail:subject"" like '%Sample Mail%' "

No alt text provided for this image

Finally, use the output of this activity (a list of MailMessage objects) in subsequent activities to process the retrieved emails.

No alt text provided for this image
No alt text provided for this image

Step 2: Organize them into folders and subfolders based on their subjects.

Move Outlook Mail Message activity is used to moves an Outlook email message to a specified folder.

No alt text provided for this image

Properties

Input

MailMessage - The MailMessage object to be moved.

Account - The account used to access the messages to be moved.

MailFolder - The mail folder to which the messages are to be moved.

 Refine the filtering based on the subject and subsequently organize them into designated folders.

No alt text provided for this image

To specify the subfolder in the filter of the Get Mail activity in UiPath, you can use the following format:

 "foldername\subfoldername"

 For example, if you have a subfolder named "Invoices" inside the "Emails" folder, you can specify it in the filter as follows:

 "Emails\Invoices"

 Note that you need to use the backslash (\) character to separate the folder names. Also, make sure that the folder name is correct and matches the name of the subfolder exactly.

 Here, To streamline my emails, I've created filters that sort incoming messages based on their subject, and then direct them to the appropriate folder - either SampleFolder or SampleSubFolder.

No alt text provided for this image
No alt text provided for this image

Step 3: Send all the emails from these folders and subfolders to a designated group.

To complete the process, I will send all the emails contained in these folders and subfolders to a designated group. (SampleGroup)

To accomplish this, we can utilize the 'Send Outlook Mail Message Activity.' Simply enter the email address of the designated group in the 'To' field and ensure that your own email account is specified in the regular account field (if not already logged in).

No alt text provided for this image

Step 4: Retrieve emails from the group and respond to them.

We can use the 'Reply to Outlook Mail Message' activity to accomplish this objective. This activity Replies to an email message using Outlook.

No alt text provided for this image

To do so, we would first utilize the 'Get Outlook Mail Activity' with the filter '[To]='SampleGroup'' to retrieve the relevant emails. We can then utilize the 'Reply to Outlook Mail Message' activity to reply to each email as needed.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Please Find the link to use case I created to demonstrate above scenario.

https://github.com/anutan27/MiniProjectsUiPath/blob/main/FilterMoveReply_ForwordtoGroup.zip

 

Conclusion:

 In conclusion, the automation of Outlook Mail using UiPath can greatly enhance one's email management abilities. The use case of retrieving and replying to emails based on specific filters is just one example of how UiPath can streamline and automate email-related tasks. By utilizing activities such as 'Get Outlook Mail' and 'Reply to Outlook Mail Message', one can easily manage their inbox and improve their productivity. Overall, UiPath provides a powerful set of tools for automating various aspects of email management, allowing users to focus on other important tasks without sacrificing their efficiency.

To view or add a comment, sign in

Others also viewed

Explore content categories