IMAP Watcher

Connects to a mailbox using IMAP and waits for incoming mail on a specified folder.

Note: Basic authentication with IMAP is now deprecated by Microsoft. If you are connecting to an Office 365 or Hosted Exchange Mailbox, replace IMAP Watcher with Microsoft Graph Email Watcher. If you need to have basic authentication temporarily enabled, follow the steps outlined at https://techcommunity.microsoft.com/t5/exchange-team-blog/basic-authentication-deprecation-in-exchange-online-september/ba-p/3609437.

Revision History

1.0.1.12 Fixed bug where IMAP Watcher wouldn't shut down gracefully
1.0.1.14 Improve stability

Properties

Connection

Type: Connection Input

Host
Type: String
The IMAP Endpoint

Secure
Type: Boolean
Whether to connect over a secure channel

Username
Type: String
The username for the IMAP mailbox

Password
Type: String
The password for the IMAP mailbox

WatchedFolder
Type: String
The folder to monitor for new emails - usually Inbox

ProcessedFolder
Type: String
The folder to which processed emails should be moved

ErrorFolder
Type: String
The folder to which emails that could not be processed should be moved

FireMethod
Type: List Input
PerMessage - Indicates that the Node should fire once per email message.
PerAttachment - Indicates that the Node should fire once per attachment per email message. This is useful when it is necessary to process each attachment in a message.

Sender

Type: String Output
Contains the email address of the sender for the current email

Recipients

Type: String Output
Contains the list of recipients for the current email

Subject

Type: String Output
Contains the subject for the current email

Body

Type: Multiline Text Output
Contains the raw body for the current email

AttachmentName

Type: String Output
Contains the name of the first attachment (if FireMethod is set to PerEmail) or the current attachment (if FireMethod is set to PerAttachment)

AttachmentData

Type: Multiline Text Output
The AttachmentData Property
Contains the raw data for the current (or first) attachment. The attachment data is presented as a byte array

Remarks

When a new email is encountered, the trigger fires and the email is moved to the ProcessedFolder, or the ErrorFolder if an error occurs during processing.

Folders should be expressed as a path using slashes as a delimiter. For example Inbox/Processed.

Set FireMethod to PerAttachment if you wish to process all attachments on an email. In this mode, the Node will fire for each attachment on an email before moving on to the next folder.

Setting up a connection for Gmail

Follow the steps below to create a connection using a Gmail Account

  1. Create Labels in Gmail:

    • Open your Gmail mailbox.
    • Create two Labels: Processed, Error. These labels will help organize your emails within Gmail.
  2. Generate an App Password:

    • Go to your Google Account settings by visiting Manage your Google Account.
    • Navigate to the Security section.
    • Select 2-Step Verification and verify using the Gmail account password.
    • Scroll down and select App passwords.
    • Enter a name for your App Password and click Create.
    • Copy the generated App Password and paste it into a notepad, removing the spaces.
  3. Configure Connection Settings:

    • Input the following connection details:
      • Host: imap.gmail.com
      • Secure: Enabled
      • Username: Your Gmail email address
      • Password: Paste the App Password generated in step 2
      • WatchFolder: inbox
      • ProcessedFolder: Processed
      • ErrorFolder: Error
      • MaxMessageSize: Leave this blank to include all emails.

    Save the connection, navigate back to your design canvas and test the workflow.

Troubleshooting

IMAP Client Exception: LOGIN failed.

Microsoft started disabling basic authentication. You need to follow this process to enable it again. Basic Authentication and Exchange Online – June 2021 Update - Microsoft Tech Community

The user must be signed in as a global administrator, not a delegated administrator.