Read and Review Automation Anywhere Documentation

Automation 360

Close Contents

Contents

Open Contents

Using the For each mail in mail box iterator

  • Updated: 7/05/2021
    • Automation 360 v.x
    • Build
    • RPA Workspace

Using the For each mail in mail box iterator

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 the Connect action

You must use the following Email actions within a loop:
  • Change status
  • Delete
  • Save attachments
  • Save email

Procedure

To use an Email action within a loop, follow these steps:

  1. Double-click or drag the Loop action from the Loop package in the Actions palette.
  2. Select the For each mail in mail box option from the Iterator list.
  3. In the Session name field, enter the name of the session you used to connect to the email server in the Connect action.
  4. 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.
  5. 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.

  6. Optional: In the When subject contains field, specify a value to retrieve emails containing the value you specified in their subject.
  7. Optional: In the From specific senders field, specify the email addresses to retrieve the emails.
  8. Optional: In the When received date is on or after list, select an option to retrieve specific emails on or after a certain date.
  9. 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.
  10. In the Plain text or HTML options, select the format that you want to use.
  11. 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.
  12. Optional: In the Assign the current value to variable list, select or create a dictionary variable.

    The dictionary variable stores the properties of each email. Using dictionary variable for email properties.

  13. 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}$
Send Feedback