UiPath

Send and receive email with UiPath (Outlook, Microsoft365, IMAP, POP, SMTP)

In UiPath Studio development, you may want to send or receive emails from your business partners, when the robot execution is completed, or when an error occurs.

This article will explain how to send and receive email using Outlook, Microsoft365, IMAP, POP, and SMTP.

 

 Related Articles Learn the Creation Techniques f UiPath robotics creation with Udemy’s online courses that take it up a notch

This site was created by translating a blog created in Japanese into English using the DeepL translation.

Please forgive me if some of the English text is a little strange

How to send and receive email

There are several ways to send and receive email: application specific (Outlook), service specific (Microsoft365, Exchange, IBM Notes), protocol specific (IMAP, POP, SMTP), and UI manipulation (manipulate any software or webmail).

 

How to send and receive email

Classification target Stability of the process
(Is it resistant to external changes?)
security Sample in this article
App Designation Outlook Y Y Y
service specification Microsoft365 Y Y Y
Exchange Y n
IBM Notes Y Y
protocol specification IMAP Y n Y
POP Y n Y
SMTP Y n Y
UI Operation Any software n Y
Any webmail n Y

*Y:yes,     n:neither,     N:no,    -:None

F-pen
F-pen
Specifying the protocol is not recommended from a security point of view, since it requires setting the server, user name (e-mail address), and password in the activity.
sea otter
sea otter
UI operation is a less stable process because you use clicks and keyboards to control your email software and webmail, so it is more likely to stop working due to changes in the software or web system.

We recommend Outlook, because you can set up your email in Outlook beforehand, and you don’t need to set up accounts and passwords for activities.

If you are going to use Microsoft365, we recommend using Microsoft365 Activity.

This is because the authentication method can be changed according to the operation, and Read and Write permissions can be set, so security can be specified in detail.

 

Sending and receiving email using Outlook activities

The Outlook Activity is located in the App Integration > Mail > Outlook.

 

Outlook Activity

Activity Name Activity behavior
Get Outlook Mail Messages Retrieve email messages from Outlook.
Move Outlook Mail Message Moves Outlook email messages to the specified folder.
Send Outlook Mail Message Send an email message from Outlook.
Save Outlook Mail Message Saves your Outlook email messages in the specified folder.
Delete Outlook Mail Message Deletes an Outlook email message.
Reply To Outlook Mail Message Replies to an email message using Outlook.
Set Outlook Mail Categories Assigns categories to a specified mail message.
Mark Outlook Mail As Read/Unread Marks the specified mail message as read or unread.

 

Get Outlook Mail Messages

Use Get Outlook Mail Messages to get your Outlook mail.

“Get Outlook Mail Messages” is located in App Integration> Mail> Outlook.

 

Get Outlook Mail Messages  Setting item

Setting location Setting item Setting contentcs
Properties Common DisplayName The display name of the activity.
TimeoutMS Specifies the amount of time (in milliseconds) to wait for the activity to run before an error is thrown.
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.
FilterByMessageIds Returns only mail messages that match the specified message IDs.
MarkAsRead Specifies whether to mark retrieved messages as read.
OnlyUnreadMessages Specifies whether to retrieve only unread messages.
OrderByDate Orders mail messages by date.
Top The number of messages to be retrieved starting from either the newest or the oldest, depending on the OrderByDate parameter.
Output
Messages The retrieved messages as a collection of MailMessage objects
Misc
Private If selected, the values of variables and arguments are no longer logged at Verbose level.

 

Sample Process
Use “Get Outlook Mail Messages” to retrieve the emails and display the From, Subject, and Body of the first email in the log message.

 

・Get Outlook Mail Messages  Properties

・Variables

F-pen
F-pen
The “Get Outlook Mail Messages” activity extracts emails from Outlook as a List type of MailMessage.
It outputs the 0th From, Subject, and Body of the mailList (List type of MailMessage) to the log message.
sea otter
sea otter
For the items that can be output in MailMessage other than From, Subject, and Body, please refer to the following reference notes.

 

・Target Outlook email

・Execution result

 

Send Outlook Mail Message

To send an email in Outlook, use “Send Outlook Mail Message”.

“Send Outlook Mail Message” is located in App Integration > Mail > Outlook.

 

Send Outlook Mail Message  Setting item

Setting location Setting item Setting contents
Properties Attachments Attachments The attachments to be added to the email message.
AttachmentsCollection Enables you to specify a list of attachments to be added to the email message.
Common DisplayName The display name of the activity.
TimeoutMS Specifies the amount of time (in milliseconds) to wait for the activity to run before an error is thrown.
Email Body The body of the email message.
Subject The subject of the email message.
Forward MailMessage The message to be forwarded.
Input Account The account used to send the messages.
SentOnBehalfOfName The display name of the sender of the mail message.
Options
Importance Specifies the importance of the mail message
IsBodyHtml Specifies whether the body of the message is written in HTML format.
IsDraft Specifies whether the message should be saved as a draft.
ReplyTo The email addresses to be used when replying.
Sensitivity Specifies the sensitivity of the mail message
Receiver Bcc The hidden recipients of the email message.
Cc The secondary recipients of the email message.
To The main recipients of the email message.
Misc
Private If selected, the values of variables and arguments are no longer logged at Verbose level.

 

Sample Process
Send an email with Outlook Activity.

 

・Send Outlook Mail Message  Properties

・Execution result

・Email send

 

 

Service specification (Microsoft365, Exchange, IBM Notes)

Microsoft365 email activity can be found in Integrations> Microsoft> Office365> Outlook
*You will need to install the UiPath.MicrosoftOffice365.Activities activity package, as described in Installing MicrosoftOffice365 Activities.

Mail activities for Exchange and IBM Notes can be found in App Integration > Mail.

 

Email activity for Microsoft365, Exchange, and IBM Notes

Activites location Activites Name Activity behavior
Integration > Microsoft > Office365 > Outlook Set Mail Categories Uses the Microsoft Graph Update message API to associate categories with a message.
Delete Mail Uses the Microsoft Graph Delete message API to delete an email message.
Get Mail Uses the Microsoft Graph Get message and List messages APIs to retrieve the matching messages from a specified mailbox (Mailbox).
Move Mail Uses the Microsoft Graph Move event message API to move a message (Message) to a different mail folder (DestinationFolder).
Forward Mail Uses the Microsoft Graph Create forward and Forward event message API to forward a message (Message), with additional content (Body), to one or more recipients (To).
Send Mail Uses the Microsoft Graph Create message and Send mail APIs to send a message (Body and Subject) to one or more recipients (To, CC, and BCC).
App Integration > Mail > Exchange Delete Exchange Mail Message Deletes an Exchange email message.
Get Exchange Mail Messages Retrieves an email message from Exchange.
Send Exchange Mail Message Sends an email message from Exchange.
App Integration > Mail > IBM Notes Delete IBM Notes Mail Message Deletes a specified mail message from IBM Notes.
Get IBM Notes Mail Messages Retrieves mail messages from IBM Notes.
Move IBM Notes Mail Message Moves a IBM Notes mail message to a specified folder.
Send IBM Notes Mail Message Sends a mail message by using IBM Notes.

 

Installing MicrosoftOffice365 Activities

In order to use MicrosoftOffice365 Activities, you need to install the “UiPath.MicrosoftOffice365.Activities” activity package.

 

Instructions for installing the “UiPath.MicrosoftOffice365.Activities” activity package

①Click “Manage Packages”

②[Click All Packages and enter “UiPath.MicrosoftOffice365.Activities” in the search window.

③Click [UiPath.MicrosoftOffice365.Activities], and then click [Install].

④Click “Save”.

⑤Enter “Office365” in the activity search window and confirm that the activity is displayed.

This completes the installation of the [UiPath.MicrosoftOffice365.Activities] activity package.

 

Configuration of AzureAD

Each activity in MicrosoftOffice365 operates in a sequence within the “Microsoft Office 365 Scope”.

The “Microsoft Office 365 Scope” is authenticated with AzureAD, and you need to register apps and set API permissions in AzureAD.

F-pen
F-pen
For more information on the authentication mechanism and specific configuration procedures, please refer to the following reference links.

 

Configuring Microsoft Office 365 Scope

There are five types of authentication methods for the Microsoft Office 365 Scope, which runs each MicrosoftOffice365 activity.

  • InteractiveToken
  • IntegratedWindowsAuthentication
  • UsernameAndPassword
  • ApplicationIdAndSecret
  • ApplicationIdAndCertificate

 

For a more detailed description of the authentication method, please refer to the following reference links.

 

Get Outlook email for Microsoft 365 (Get Mail)

To retrieve Outlook mail for Microsoft 365, use Get Mail in Integrasions > Microsoft > Office365 > Outlook.

 

Get Mail  Setting item

Setting location Setting item Setting contents
Properties Common DisplayName The display name of the activity.
Input Account (Optional) The email address with which to interact.
Mail Folder The mail folder from which the messages are retrieved.
Misc Private If selected, the values of variables and arguments are no longer logged at Verbose level.
Options Get As HTML  If selected, the message body is returned in HTML format.
Mark As Read If selected, the returned messages are marked as read.
Only Unread Messages If selected, only unread messages are returned.
Order By Date The returned messages are ordered by date.
Query Query used for filtering the returned emails.
Top The maximum number of emails to retrieve.
Output Result Returns all emails from the user’s inbox.

 

Sample Process
Retrieve Outlook emails in Microsoft 365 and display the From, Subject, and Body of the first email to the log message.

 

・Microsoft Office 365 Scope  Properties

・Get Mail  Properties

・Variables

F-pen
F-pen
The “Get Mail” activity will output an Array type of Office365Message in the output result.

 

・Email to be retrieved

・Execution result

 

Send Outlook email for Microsoft 365 (Send Mail)

To retrieve Outlook mail for Microsoft 365, use Send Mail in Inhtegrations> Microsoft> Office365> Outlook.

 

Send Mail  Setting item

Setting location Setting item Setting Contents
Properties Attachments Attachments A collection containing the paths to the files attached to the email.
Attachments Collection An additional list of files attached to the message.
Common DisplayName The display name of the activity.
Email Body The email’s message body.
Subject The subject of the email.
Input Account (Optional) The email address with which to interact.
Misc Private If selected, the values of variables and arguments are no longer logged at Verbose level.
Options From The email address from which the email is sent.
Importance The importance of the mail message.
Is Body HTML If selected, the body of the email is interpreted in HTML format.
Is Draft If selected, the message is saved as a draft and not sent.
Reply to The email addresses to use when replying.
Recipients Bcc A comma-separated list of email addresses that you want to be included as Bcc recipients.
Cc  A comma-separated list of email addresses that you want to be included as Cc recipients.
To A comma-separated list of email addresses that you want to send your mail to.

 

Sample Process
Send an email with Outlook in Microsoft 365.

 

・Microsoft Office 365 Scope  Properties

・Send Mail  Properties

・Execution result Log

・Mail sent items for sent emails.

 

Specify protocol (IMAP, POP, SMTP)

IMAP, POP, and SMTP mail activities can be found in the App Integration > Mail.

 

IMAP, POP, and SMTP email activity

アクティビティの場所 アクティビティ名 アクティビティの動作
App Integration > Mail > IMAP Get IMAP Mail Messages Retrieves an IMAP email message from a specified server.
Move IMAP Mail Message Moves an IMAP email message to a specified folder.
App Integration > Mail > POP3 Get POP3 Mail Message Retrieves a POP3 email message from a specified server.
App Integration > Mail > SMTP Send SMTP Mail Message Sends an email message by using the SMTP protocol.

 

Get IMAP Mail Messages

To retrieve IMAP mail messages, use Get IMAP Mail Messages.

Get IMAP Mail Messages is located in the app’s Connectivity > Mail > IMAP.

 

Get IMAP Mail Messages  Setting item

設定場所 設定項目 設定内容
Properties Common DisplayName The display name of the activity.
TimeoutMS Specifies the amount of time (in milliseconds) to wait for the activity to run before an error is thrown.
Host MailFolder The mail folder from which the messages are to be retrieved.
Server The email server host that is to be used.
Port The port used to get the email message.
Logon Email The email account used to get the message.
Password The password of the email account used to get the message.
SecurePassword The password of the email account used, as a secure string.
Misc Private If selected, the values of variables and arguments are no longer logged at Verbose level.
Options DeleteMessages Specifies if the read messages should be marked for delete.
FilterExpression Returns only those mail messages matching the filter expression.
FilterExpressionCharacterSet The MIME name of the character set to be used for the filter expression.
MarkAsRead Specifies whether to mark retrieved messages as read. By default, this check box is cleared.
OnlyUnreadMessages Specifies whether to retrieve only unread messages.
OrderByDate Order mail messages by date.
SecureConnection Specifies the SSL and/or TLS encryption to be used for the connection.
Top The number of messages to be retrieved, starting from either the newest or the oldest, depending on the OrderByDate parameter.
Output Messages The retrieved messages as a collection of MailMessage objects.

 

Sample Process
Retrieve the mail by IMAP and output the subject and body of the first message to the log.

・Get IMAP Mail Messages  Properties

 

・Variables

 

・Email to be retrieved

・Execution result  Log

 

Get POP3 Mail Message

To retrieve a POP3 mail message, use “Get POP3 Mail Message”.

The “Get POP3 Mail Message” can be found in App Integration > Mail > POP3.

 

Get POP3 Mail Message  Setting item

Setting location Setting item Settting contents
Properties Logon Email The email account used to get the message.
Password The password of the email account used to get the message.
SecurePassword The password of the email account used, as a secure string.
Host Server The email server host that is to be used.
Port The port used to get the email message.
Options DeleteMessages Specifies if the read messages should be marked for delete.
SecureConnection Specifies the SSL and/or TLS encryption to be used for the connection.
Top The number of messages to be retrieved starting from the top of the list.
Common DisplayName The display name of the activity.
TimeoutMS Specifies the amount of time (in milliseconds) to wait for the activity to run before an error is thrown.
Output Messages The retrieved messages as a collection of MailMessage objects.
Misc Private If selected, the values of variables and arguments are no longer logged at Verbose level.

 

Sample Process
Retrieve the mail by POP and output the From, Subject, and Body of the first message to the log.

・Get POP3 Mail Messages  Properties

 

・Variables

 

・Email to be retrieved

・Execution result Log

 

Send SMTP Mail Message

To send an SMTP mail message, use “Send SMTP Mail Message”.

The “Send SMTP Mail Message” is located in AppIntegration > Mail > SMTP.

 

Send SMTP Mail Message  Setting item

Setting location Setting item Setting contents
Properties Logon Email The email account used to send the message.
Password The password of the email account used to send the message.
SecurePassword The password of the email account used, as a secure string.
Host Server The email server host that is to be used.
Port The port that the email message is to be sent through.
Sender Name The display name of the sender.
From The email address of the sender.
Options IsBodyHtml Specifies whether the body of the message is written in HTML format.
ReplyTo The email address to be used when replying.
SecureConnection Specifies the SSL and/or TLS encryption to be used for the connection.
Receiver To The main recipients of the email message.
Cc The secondary recipients of the email message.
Bcc The hidden recipients of the email message.
Email Subject The subject of the email message.
Body The body of the email message.
Common DisplayName The display name of the activity.
TimeoutMS Specifies the amount of time (in milliseconds) to wait for the activity to run before an error is thrown.
Attachments Files The attachments to be added to the email message.
Forward MailMessage The message to be forwarded.
Misc Private  If selected, the values of variables and arguments are no longer logged at Verbose level.

 

Sample Process
Send mail via SMTP.

 

・Send SMTP Mail Message  Properties

・Execution result  Log

・Sent email

 

Summary

[reprint]   How to send and receive e-mail

Classification target Stability of the process
(Is it resistant to external changes?)
security Sample in this article
App Designation Outlook Y Y Y
service specification Microsoft365 Y Y Y
Exchange Y n
IBM Notes Y Y
protocol specification IMAP Y n Y
POP Y n Y
SMTP Y n Y
UI Operation Any software n Y
Any webmail n Y

*Y:yes,     n:neither,     N:no,    -:None

 

  • The recommended method for sending and receiving email is Outlook, because you can set up your email in Outlook beforehand and you don’t need to set up accounts and passwords in Activities.
  • The protocol specification is not recommended for security reasons, as it requires setting the server, username (email address), and password in the activity.
  • UI operation is not a stable process because it requires the user to control the mail software or webmail by clicking or keyboarding, which may not work due to changes in the software or web system.

Back to Table of Contents

 

 Related Articles Learn the Creation Techniques f UiPath robotics creation with Udemy’s online courses that take it up a notch

 same category UiPath

 

The operator of this blog, F-penIT blog