Mandala
Triggers

IMAP Trigger

Trigger a workflow run automatically whenever a new email matches your criteria on an IMAP server.

The IMAP Email Trigger is a polling-based trigger that automatically monitors a designated mailbox (such as Gmail, Outlook, or Yahoo) at regular intervals.

graph TD
  A[IMAP Server / Mailbox] -->|New Email matches filters| B[Mandala Poller]
  B -->|Every 1 min| C[Trigger Workflow Run]

[!NOTE] Polling runs every 1 minute. Each new email that meets your configuration filters will trigger one separate workflow run containing the email's details. The system tracks processed emails by their IMAP UID to prevent duplicate runs.


Configuration Inputs

ParameterTypeRequiredDefaultDescription
imapHoststringYes-IMAP server hostname (e.g. imap.gmail.com)
imapPortstringYes993IMAP server port
imapSecuredropdownYesSSLSecurity protocol: SSL, TLS, or None
imapUsernamestringYes-Your email address (e.g. user@gmail.com)
imapPasswordstringYes-Password or App Password (recommended)
mailboxstringNoINBOXMailbox folder to poll
filterUnreadOnlyswitchNotrueWhen active, only processes unread emails
markAsReadswitchNofalseMarks processed emails as SEEN on the server
includeAttachmentsswitchNofalseWhether to download attachments immediately during the trigger
filterFromstringNo-Filter by specific sender (e.g. invoices@company.com)
filterSubjectstringNo-Filter emails by keyword in the subject

Outputs

When the trigger fires, the following payload structure is made available to subsequent blocks under the trigger object:

{
  "email": {
    "id": "12345", 
    "subject": "Invoice for June",
    "from": "billing@company.com",
    "to": "you@domain.com",
    "cc": "finance@domain.com",
    "date": "2026-06-16T10:15:30.000Z",
    "bodyText": "Hi there, please find attached...",
    "bodyHtml": "<p>Hi there, please find attached...</p>",
    "hasAttachments": true,
    "attachments": [] 
  },
  "timestamp": "2026-06-16T10:16:00.000Z"
}

Downstream Integration (Attachments)

If you need to process email attachments (e.g. parse PDFs, extract tables, etc.), it is recommended to:

  1. Leave Include Attachments disabled on the trigger to keep payload sizes small.
  2. Chain the IMAP: Get Attachments block downstream.
  3. Wire the message identifier field using:
    {{trigger.email.id}}

Mail Provider Setup Instructions

Connecting to third-party mail providers usually requires configuring security rules:

Gmail Setup

  1. Enable IMAP Access in your Gmail settings under Forwarding and POP/IMAP.
  2. Turn on 2-Step Verification for your Google account.
  3. Generate an App Password under Account Security, and use it as your imapPassword in Mandala.

Outlook / Office 365 Setup

  • Host: outlook.office365.com (Port 993, SSL).
  • Use an App Password if Multi-Factor Authentication is active on your tenant.
IMAP Trigger