Subscribe

UiPath Activities

The UiPath Activities Guide

For Each Email

UiPath.Mail.Activities.Business.ForEachEMailX

Executes one or more activities for each email or email invite in a specified Outlook folder or with a specified Gmail label. This activity must be added inside a Use Outlook 365, Use Gmail, or Use Desktop Outlook App activity.

Use this activity when you are working with multiple messages and you want to repeat one or more activities for each individual message:

  • For the Outlook desktop app, indicate a folder whose emails to iterate through, or iterate through the folder or the emails that are selected in Outlook when the project is executed.
  • For Outlook 365, indicate a folder whose emails to iterate through.
  • For Gmail, indicate a label whose emails to iterate through. You can select a custom label or one of the following default labels: Inbox, Sent, and Spam.

Add the activities to repeat inside For Each Email and, when you configure the activities, select CurrentMail from the Plus plus buttonplus button menu to indicate that you want to repeat the actions for each message in the iteration. For some activities, you must select a specific message field to use from each email: Subject, Body (message body in plain text), Body as HTML (message body formatted in HTML), Date (as text), Bcc, Cc, To, From (sender and recipient fields return a list of email addresses separated by semicolon), or Priority (High, Low, Normal).

To learn how to use this activity, see:

Configuring the Activity

In the Body of the Activity

  • For each - Enter the name by which to refer to the current email in the iteration. Using a name that describes the type of email makes it easier to identify and select the current email option when configuring activities added inside For Each Email. For example, for a selection of emails that contain invoices, you can enter Invoice. The default value is CurrentMail.
  • In emails from - Click Plus plus buttonplus button on the right side of the field and then, from the menu, select the folder or label you want to use, or, when automating the Outlook desktop app, choose Selected Mails or Selected Folder to use the messages or the folder selected in Outlook when the project is executed. Alternatively, you can select Open in Advanced Editor and enter a VB expression.
  • Limit emails to first - Enter or select a limit for the maximum number of emails to process. Set a lower limit if you want to reduce processing times. The default value is 100 emails.
  • Unread mail - Select this option if you want to process only unread emails. This option is not selected by default.
  • Additional filters - Click this button to configure an advanced filter for the emails to process.
    In the Filter window:
    • From the first drop-down menu, select an email field to filter by: Bcc, Body, Cc, Date, From, To, Subject, or Categories.
    • From the second drop-down menu, select an operator to evaluate the email field:
      • For all fields with the exception of Date and Categories: contains, does not contain, ends with, starts with, equals, is empty, or is not empty.
      • For the Date field: older than, newer than, or equals the time period indicated in the third field.
      • For the Categories field: contains, does not contain.
    • Click Plus plus buttonplus button on the right side of the third field, and then use one of the options in the menu to indicate the value against which to evaluate the selected email field:
      • Data from the Project Notebook, a parent Excel file or email account. For example, indicate a field in the email that is selected in Outlook when the project is executed.
      • Use Saved Value - Use data that you previously saved for later use in the project.
      • Text - Enter text in the Text Builder.
      • Ask when run - Prompt for a value when the project is executed.
      • Paste from clipboardΒ - Paste a value that you previously copied to the clipboard in the project.
      • Open in Advanced Editor - Enter a VB expression.
    • Click Add if you want to add other conditions, and select if All or Any of the conditions should be used to filter.

In the Properties Panel

Common

  • DisplayName - The name displayed for the activity in the Designer panel.

Misc

  • Private - If selected, the data used in the activity is not logged by StudioX.

Options

πŸ“˜

Note:

When automating the Outlook desktop app, the activity only processes emails stored locally in the Outlook data file. For information on what to do if some of your emails are not processed, see Outlook Troubleshooting in the StudioX Guide.

Updated 4 months ago


For Each Email


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.