Using the For each mail in mail box iterator for Apple Mail

Automate the processing of emails in an Apple Mail mailbox on macOS by iterating through each email and performing specified actions.

Prerequisites

  • Ensure Apple Mail is configured and accessible on your macOS system.
  • Establish a connection to the Apple Mail server using the appropriate Connect action.

Settings

  • Double-click or drag the Loop action from the Loop package in the Actions palette.
  • Select the Apple Mail - For each mail in mail box option from the Iterator list.
  • In the Session name field, enter the session name you used to connect to the Apple Mail in the Connect action.
  • In the Status of email field, select one of the following types of emails to move:
    • Read: emails that are in Read status.
    • Unread: emails that are in Unread status.
    • Both: emails in Read and Unread status.
  • From the Sort email option, select Latest first or Oldest first to sort the emails in a specific order.
  • In the From specific folders field, specify the folder path from where you want to retrieve the emails. For example, Inbox/folder1;Inbox/folder2.
  • Optional: In the When subject contains field, specify a value to retrieve emails containing the value you specified in the subject.

    You can enter multiple text separated by semi-colon.

  • 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 field, specify the received date. The filter will apply to emails received on or after that date, retrieving only those emails. For example, if you enter a received date of April 12, 2025, only emails received on or after that date will be included, while emails received before that date will be excluded.
  • Optional: In the When received date is on or before field, specify the received date. The filter will apply to emails received on or before that date, retrieving only those emails. For example, if you enter a received date of April 12, 2025, only emails received on or before that date will be included, while emails received after that date will be excluded.
    注: The Message format is selected as PLAINTEXT by default. HTML format is currently not supported.
  • Choose one of the following options from Use local timezone :
    • True: The email received date and time is converted in the local time zone.
    • False: The email received date and time is converted in the UTC time zone.
    • Variable: Enter a Boolean variable.
    • Optional: In the Assign the current value to variable field, choose either Multiple variables or Dictionary variable to save the output:
      • If using Multiple variables, use the following steps for each variable:
        • Click Add variable mapping.
        • Enter the Key of the variable.
        • In the Map to variable field, choose a variable where the data will be saved.
        • Click Add for this data to be saved to the configured variable.
      • If using a Dictionary variable, then select the variable where outcome data can be saved.