Get email from a mail server
- Derniรจre mise ร jour2022/10/28
Get email from a mail server
The Get All Messages action of the Email Automation command enables you to retrieve emails from a mail server.
If you choose the server type as the Exchange Web Services (EWS) using OAuth authentication, the Tenant ID and Client ID fields are mandatory although the interface displays these fields as optional because they can be skipped for Basic Authentication. The recommended practice is to use OAuth authentication for enhanced security.
Procedure
To retrieve emails from a mail server, do the following:
-
Double-click or drag one of the Email Automation commands to the Task
Actions List pane.
The Email Automation dialog box appears.
- Select the Get All Messages option to retrieve emails from the mail server.
-
Select an option from the Server Type section.
- IMAP
- POP3
- EWS
-
Specify details of the email server:
-
For IMAP and POP3 server
specify the following details:
-
Version 11.3.5.7, Version 11.3.1.13, Version 11.3.4.8 or later:
- Host Name: Host name of the email server.
- User Name: User name you want to use to connect to the email server.
- Server uses secure connection (SSL): Select this option if the email account uses secured connection.
- Port Number: Port that you want to use to connect to the email server.
-
Use local timezone: Select the
Use local timezone check box to convert
the server time zone to the local time zone.
When the Use local timezone check box is selected, the email received date and time is displayed in the local time zone. If the check box option is not selected, the email received date and time is displayed in the server time zone.
-
Auth Type: Choose from the following
authentication types:
- Basic: Uses the username and password.
-
OAuth2 โ Client credentials: Uses
client credentials flow.
See Authenticate an IMAP, POP or SMTP connection using OAuth
-
OAuth2 โ Authorization code with
PKCE: Uses authorization code with PKCE grant
flow.
See Microsoft identity platform and OAuth 2.0 authorization code flow
Option Description Basic Enter the password for the username you provided. OAuth2 โ Client credentials Provide the following details: - Client ID and Tenant ID: Enter the unique client and tenant IDs generated when you registered the application in the Microsoft Azure portal.
- Client secret: Enter the client secret that you generated for your app in the app registration portal.
OAuth2 โ Authorization code with PKCE Provide the following details: - Client ID and Tenant ID: Enter the unique client and tenant IDs generated when you registered the application in the Microsoft Azure portal.
- Redirect URI: The redirect URI in your Azure app registration portal.
-
Connect: Click this
option to sign into your account, accept the
permissions requested to authenticate, and
establish a connection with the OAuth server.Note: You must establish the connection only when you connect for the first time.
Keep the following considerations in mind when you use authorization code with PKCE.- Ensure that the redirect URL format is
http://localhost:9090/callback
- In Redirect URL, only HTTP is supported.
- URL
urn:ietf:wg:oauth:2.0:oob
is required while configuring the PKCE on Azure portal. - You can add only Mobile and desktop applications when you configure the platforms in Azure portal.
- The consent page appears only for the first time when you authenticate for the first time. However, when you run your email automation, each time, you are asked to sign in to your Microsoft account and provide the username and password.
- To log in to your Microsoft account, you must provide the same username that you provided in the Email Automation command to run the bots.
-
Note:
- For attended email automation, use PKCE flow.
- The email automation created using Version 11.3.5.7 (Basic and OAuth2.0) will not work in the environments where earlier versions of Enterprise 11 (prior to Version 11.3.5.7) clients are used. However, if the bot is not modified in Version 11.3.5.7, it will continue to work in the earlier versions. Any changes to the email command fields will update the internal structure, and the bots will not work in the earlier versions after these changes.
- As a best practice, use credential variables for the client secret, password, and other related fields to avoid storing sensitive information.
The above points also apply to Version 11.3.1.13 and Version 11.3.4.8.
-
Prior to Version 11.3.5.7, Version 11.3.1.13, and Version 11.3.4.8
:
- Host Name: Host name of the email server.
- User Name: User name you want to use to connect to the email server.
- Password: Password you want to use to connect to the email server.
- Server uses secure connection: Select this option if the email account uses secured connection.
- Port Number: Port that you want to use to connect to the email server
-
Use
local timezone: Select the Use local
timezone check box to convert the server time zone
to the local time zone.
When the Use local timezone check box is selected, the email received date and time is displayed in the local time zone. If the check box option is not selected, the email received date and time is displayed in the server time zone.
Note: This feature is available in the following versions: Version 11.3.3.3 and 11.3.3.3.x, and Version 11.3.5.1 and later. It is not available in Version 11.3.4.x and Version 11.3.5.
-
Version 11.3.5.7, Version 11.3.1.13, Version 11.3.4.8 or later:
-
For Exchange Web Services (EWS), specify the following
details:
- Domain Name: Domain name of the EWS server.
- User Name: User name you want to use to connect to the email server.
- Password: Password you want to use to connect to the email server.
- Client ID and Tenant ID: Enter the unique client and tenant IDs generated when you registered the application in the Microsoft Azure portal. These fields are required for OAuth.
- Exchange Version: Select an option from the list to specify the version of the EWS server you want to use.
-
Exchange Url: Specify the
URL of the EWS server.
You can click the Fetch option to populate the Exchange Url field based on the values you have provided in the User Name and Password fields.
-
For IMAP and POP3 server
specify the following details:
-
Select an option to specify which emails to retrieve:
- All: Retrieves all emails.
- Read: Retrieves emails that are read.
- Unread: Retrieves emails that are unread.
Note: This option is not available for POP3 type email server. -
Select an option to specify the format in which you want to download the email messages:
- HTML
- Plain Text
-
Specify the location where you want to save the downloaded attachments in the Save attachment in field.
Note: If the Save attachment in field is left blank, the attachments are saved at the location specified in Tools > Options > Run > Time > Start in path.
- Select the Overwrite File option if you want to overwrite the existing files with the downloaded files.
-
Click Save.
The system stores various information about emails retrieved such as subject, sender, and message in system variables. See Email System Variables.