You must use certain Email
actions within a Loop
action. Use the For each mail in mail box iterator to
repeat a set of actions on all the emails within the specific
parameters.
Prerequisites
First, connect to the email server. Using Connect action in Email package
When you establish a connection with Microsoft Outlook, email messages are processed
from the shared mailbox. Ensure that you have set up the shared mailbox in your
Outlook application.
Note: This feature is supported only for
Outlook.
You must use the following Email
actions within a loop:
- Change status
- Delete
- Save attachments
- Save email
Emails are retrieved based on the sequence of the folders listed in the inbox field.
Within each folder, emails are retrieved based on received date and time in the last in,
first out (LIFO) order. Additionally, you can apply filters on the following
fields:
Note: The first-in, first-out (FIFO) order is currently
not supported for reading and retrieving emails.
- Types of emails: All, Read, and
Unread
- Subject
- From a specific folder
- From specific sender
- Before, on, or after received date
Procedure
To use an Email
action within a loop, follow these steps:
-
Double-click or drag the Loop
action from the Loop
package in the
Actions
palette.
-
Select the For each mail in mail box option from the
Iterator list.
-
In the Session name field, enter the name of the session
that you used to connect to the email server in the
Connect
action.
-
In the ALL, READ, or
UNREAD options, specify the type of email to retrieve
from the email server.
Note: For an email server that uses the POP3 protocol, all emails
are retrieved.
- Optional:
Specify the folder from which you want to retrieve the emails.
-
Microsoft Outlook and Yahoo: You can specify the name of
the folder.
For example, Inbox,
Sent, Inbox/Sales,
Inbox/IT and so on. The
Sales and IT folders
in this example are user-created folders and not available by
default.
-
Gmail:
- To retrieve emails from the default folders, you must use
[Gmail]/FOLDER
,
except for the Inbox folder.
For
example, [Gmail]/Draft,
[Gmail]/Important,
[Gmail]/Trash, and so on.
- To retrieve emails from the folders you have created or the
Inbox folder, you must specify the
folder names as they are.
For example, if you have created
folders called Bank and
Sports in your Gmail, specify
Bank and
Sports without the [Gmail] prefix
to retrieve emails from these folders.
- Optional:
In the When subject contains field, specify a value to
retrieve emails containing the value you specified in their subject.
You can enter multiple text separated by semi-colon. When you specify multiple
text separated by semi-colon, the emails are retrieved with any text or
combination of text. For example, [Subject]=[Automation
Anywhere]
: The filter searches and retrieves emails where subject
text includes Automation or Automation Anywhere.
- Optional:
In the From specific senders field, specify the email
addresses to retrieve the emails.
- Optional:
In the When received date is on or after list, select an
option to retrieve specific emails on or after a certain date.
- Optional:
In the When received date is on or before list, select
an option to retrieve specific emails on or before a certain date.
If you have specified values for Steps 6
through 9, the system retrieves only those emails that meet all the criteria.
For example, if you specify Bank in Step 5,
Statement in Step 6, and
abcbank@xyz.com in Step 7, the system retrieves
emails from the Bank folder that contain Statement
in the subject and were received from the abcbank@xyz.com email
address.
-
Choose one of the following options from Use local
timezone
- True: The email received date and time is displayed in the local time
zone.
- False: The email received date and time is displayed in the UTC time
zone.
- Variable: Enter a Boolean variable.
- Optional:
In the Assign the current value to variable list, select
or create a dictionary variable.
-
Click Save.
Insert a Message Box
action into the Loop container to print the
subject of each email. Use the following message body, substituting the generic variable
name for the one you used in Step 10:
$dictionaryVar{emailSubject}$