ForEachMail

Estimated reading: 4 minutes 1644 views

This activity refers to a loop activity designed to perform actions on a collection of emails, such as reading, processing, or moving each email message individually within the loop based on specific conditions. Ensure this activity is included within a designated parent activity, “Outlook Scope”.

Properties

INPUT

Limit: This parameter indicates the maximum number of emails to be looped through to perform a set of actions. This parameter accepts the value in “String” datatype. You can either hardcode the value in “String” datatype or provide the variables in “String” format. Else, you can choose the number of mails from the drop-down available in the activity.

MailsFrom: * This parameter specifies the “Folder” from which the set of actions will be performed. To choose the folder, click the “+” icon next to the box and select the required folder from the dropdown menu.

MISC

DisplayName: Displays the name of the activity. The activity name can be customized, which aids in troubleshooting.

SkipOnError: Specify the “Boolean” value as “True” or “False.”
True: Continue executing the workflow regardless of any errors thrown.
False: Halt the workflow if it encounters any errors.
None: If the option is left blank, the activity will, by default, behave as if “False” were chosen.

Version: It indicates the version of the feature being used.

OUTPUT

Result: It provides the ability to view the execution status of the activity. It returns values in “Boolean.”
True: Indicates that the activity has been executed successfully without any errors.
False: Indicates that the activity has been unsuccessful due to an unexpected error being thrown.

Represents mandatory fields to execute the workflow.

Setting up the activity

Let’s see how to set up and configure the fields in the activity.
1. For Each (Current MailItem): This represents the name used to reference each email within the body of the “For Each Mail” activity. By default, the value is “Current Mail.” You can customize this name as needed.
2. EmailsFrom: It indicates the folder from which emails should be read and processed in a loop for the specified actions. To choose the folder, click the “+” icon next to the box and select the required folder from the dropdown menu.
3. Limit emails to first: This parameter sets the maximum number of emails to be looped through for performing a set of actions. You can select the number of emails from the provided dropdown.
a. Unread mails: Check this option to process only unread emails from the chosen folder and execute them in the loop.
b. Retrieve Attachments: Check this option to extract attachments along with the emails from the chosen folder.
c. With Attachments Only: Check this option to read and process only emails that contain attachments in the chosen folder.
d. Include subfolders: Check this option to include subfolders when reading and processing emails from within the chosen folder.

4. More Filters: Use this option to configure an advanced filter to specify any conditions for the emails to be read. Click on this to open the “Advanced Filter” wizard.
a. And / OR condition: The “AND” function returns results that meet all specified conditions, while the “OR” function returns results that meet any of the specified conditions.
b. The first dropdown lists the email fields to filter by: Bcc, Body, Cc, Date, From, To, Subject, or Categories.
c. The second dropdown lists the operators to evaluate the chosen fields. The available operators are:

    i. For the fields “Bcc, Body, Cc, From, To, Subject, and Categories,” the operators are contains, does not contain, ends with, starts with, equals, is empty, or is not empty.
    ii. For the “Date” field, the operators are older than, newer than, or equals, indicating the time period of the emails.
d. To include additional conditions, click the “Add” button.

Share this Doc

ForEachMail

Or copy link

CONTENTS