# Outlook - Multi-Mailbox Trigger

> Triggers when a new email arrives in ANY of multiple Microsoft Outlook mailboxes.

Source: https://docs.sommatic.ai/en/nodes/connectors.microsoft.outlook.trigger.multi/

- Slug: `connectors.microsoft.outlook.trigger.multi`
- Family: Connectors
- Version: 1.0.0
- Status: Partial. The scheduler does not start this trigger: it only runs when started manually, and it fires once per run, not once per email and mailbox.
- Execution: async

Triggers when a new email arrives in ANY of multiple Microsoft Outlook mailboxes.

Enterprise-grade multi-tenant mailbox listener. A single trigger node watches a list of mailboxes in parallel and fires **one workflow execution per new email**, with the originating mailbox identified in the payload. Ideal for shared inbox architectures (PQRS, support, legal intake, HR) where several functional mailboxes must feed the same triage workflow.

**How it works:**
- On each polling cycle, the trigger checks ALL configured mailboxes in parallel (one Graph API call per mailbox).
- Every new email found is emitted as an independent trigger fire — if 3 mailboxes each receive 1 new email in the same cycle, the workflow executes 3 times.
- The originating mailbox is exposed as `mailbox_email` in the output payload so downstream nodes can route or tag accordingly.
- `lastTimeChecked` state is tracked **per mailbox** independently (so a slow-polling mailbox does not block others).
- If an email has many attachments, the `heavy_attachments` port is used instead of `out` for dedicated downstream processing.

**When to prefer this over the single-mailbox trigger:**
- You have 2+ shared inboxes that should run the same workflow.
- You want to avoid maintaining N parallel workflows (one per mailbox) that all do the same thing.
- You need consistent state tracking across a mailbox cluster.

**When NOT to prefer this:**
- You have >10K emails/month and need sub-second latency — use Graph webhooks + a queue (e.g. Service Bus) instead.
- Each mailbox has materially different downstream logic — use separate workflows.

## Configuration

- `connection_id` (string, required): Credential for Microsoft Graph API access. The app registration must have Mail.Read permission (Application) on all monitored mailboxes. Accepts credentials of type `oauth2` (access + refresh token), `service-account` (tenant id + client id + client secret), or `object` (advanced Graph config).
- `mailbox_emails` (array<string>, required): List of mailbox email addresses to monitor. Each email address must be accessible by the configured credential.
- `folder` (string, optional): The mail folder to watch for new messages (same folder applies to all mailboxes). Default: `inbox`. Allowed values: `inbox`, `sentitems`, `drafts`, `deleteditems`, `junkemail`, `archive`.
- `polling_interval` (number, optional): How often to check for new emails. Minimum 60 seconds. Each mailbox is checked in parallel per cycle. Default: `60`.
- `attachment_threshold` (number, optional): Number of attachments at or above which the email routes to the heavy_attachments port instead of out. Default: `5`.
- `max_emails_per_cycle` (number, optional): Graph API $top value. Cap on how many new emails per mailbox are fetched in a single polling cycle (rest wait for next cycle). Default: `50`.

Its configuration shows the shared execution settings, but this node does not apply retries (`retryOnFail`, `maxTries`) yet. `continueOnFail` is not applied by any node.

## Output ports

- `out` (default): A new email was received (below attachment threshold). Fires once per email per mailbox.
- `heavy_attachments`: Email has attachments at or above the threshold. Route to a dedicated attachment processing node.
- `empty`: No new emails found in any monitored mailbox in this polling cycle.
- `error`: Failed to fetch emails or authentication error.

## Output contract

- `id` (string, optional): The Graph message ID. Use this for reply/forward/delete operations.
- `mailbox_email` (string, optional): The mailbox this email was received in. Use this for per-mailbox routing downstream.
- `subject` (string, optional)
- `from` (string, optional): Sender email address.
- `to` (array, optional): Recipient email addresses.
- `cc` (array, optional)
- `receivedDateTime` (string, optional)
- `body` (string, optional): Email body content.
- `bodyContentType` (string, optional)
- `bodyPreview` (string, optional)
- `isRead` (boolean, optional)
- `hasAttachments` (boolean, optional)
- `attachmentCount` (number, optional)
- `importance` (string, optional)
- `conversationId` (string, optional)
- `internetMessageId` (string, optional)

## In expressions

What a later node can read from this node's output with `$("Outlook - Multi-Mailbox Trigger").item.json.<path>` (write your node's label instead of `Outlook - Multi-Mailbox Trigger`). **Editor** marks the paths the workflow editor suggests under Previous Nodes (the output contract); **Worker** marks the paths the worker really returns through `out`, from the output shown in Ports.

- `$("Outlook - Multi-Mailbox Trigger").item.json.id` (string) = `"AAMkAGI2TG93AAA="`: The Graph message ID. Use this for reply/forward/delete operations.
- `$("Outlook - Multi-Mailbox Trigger").item.json.mailbox_email` (string) = `"billing@example.com"`: The mailbox this email was received in. Use this for per-mailbox routing downstream.
- `$("Outlook - Multi-Mailbox Trigger").item.json.subject` (string) = `"Invoice request"`
- `$("Outlook - Multi-Mailbox Trigger").item.json.from` (string) = `"ana@example.com"`: Sender email address.
- `$("Outlook - Multi-Mailbox Trigger").item.json.to` (array) = `[…] (1)`: Recipient email addresses.
- `$("Outlook - Multi-Mailbox Trigger").item.json.cc` (array) = `[…] (0)`
- `$("Outlook - Multi-Mailbox Trigger").item.json.receivedDateTime` (string) = `"2026-11-26T14:02:51Z"`
- `$("Outlook - Multi-Mailbox Trigger").item.json.body` (string) = `"<html><body><p>Please send the invoice.</p><…"`: Email body content.
- `$("Outlook - Multi-Mailbox Trigger").item.json.bodyContentType` (string) = `"html"`
- `$("Outlook - Multi-Mailbox Trigger").item.json.bodyPreview` (string) = `"Please send the invoice."`
- `$("Outlook - Multi-Mailbox Trigger").item.json.isRead` (boolean) = `false`
- `$("Outlook - Multi-Mailbox Trigger").item.json.hasAttachments` (boolean) = `false`
- `$("Outlook - Multi-Mailbox Trigger").item.json.attachmentCount` (number) **The worker does not return it: reads as undefined.**
- `$("Outlook - Multi-Mailbox Trigger").item.json.importance` (string) = `"normal"`
- `$("Outlook - Multi-Mailbox Trigger").item.json.conversationId` (string) = `"AAQkAGI2TG93CCC="`
- `$("Outlook - Multi-Mailbox Trigger").item.json.internetMessageId` (string) = `"<CAF1x2y3z@mail.example.com>"`
- `$("Outlook - Multi-Mailbox Trigger").item.json.messages` (array) = `[…] (1)` (Not suggested by the editor)
- `$("Outlook - Multi-Mailbox Trigger").item.json.count` (number) = `1` (Not suggested by the editor)
- `$("Outlook - Multi-Mailbox Trigger").item.json.hasNewEmails` (boolean) = `true` (Not suggested by the editor)
- `$("Outlook - Multi-Mailbox Trigger").item.json.lastTimeChecked` (string) = `"2026-11-26T14:03:00.120Z"` (Not suggested by the editor)


## How it works

Starts a workflow with the new messages of several Outlook mailboxes, checked in parallel, keeping a separate last-check time per mailbox. Each run emits one output with every new message in `messages` and the first one copied to the root.

1. What starts it: a manual run of the workflow. The backend scheduler does not start this node in this version (it only schedules `cron.trigger` and `connectors.microsoft.outlook.trigger`); the scheduled branch runs only when the input carries `$scheduled: true`.
2. Resolves the node config, requires `connection_id` and at least one address in `mailbox_emails` (array or comma-separated string), and gets a Graph token.
3. For each mailbox, queries `folder` for messages received since its `$trigger_state.perMailbox[<mailbox>].lastTimeChecked` (or since now when there is none), oldest first, at most `max_emails_per_cycle` (default 50), and stamps each message with `mailbox_email`.
4. Scheduled branch: one pass; a mailbox whose query fails is skipped and keeps its last-check time. Manual run: repeats the pass every `polling_interval` seconds, refreshing the token, until any mailbox has mail or 30 minutes pass; a failing mailbox fails the run.
5. Counts the attachments (up to 100) of the messages that have them, copies the first message's fields to the root, and chooses `empty` (no mail), `heavy_attachments` (the first message has `attachment_threshold` attachments or more) or `out`. Returns `meta.trigger_state.perMailbox`, which the backend stores after the run.

## In a workflow

### Node

```json
{
  "node_id": "node-shared-inboxes",
  "label": "Shared inboxes",
  "operator_slug": "connectors.microsoft.outlook.trigger.multi",
  "operator_version": "1.0.0",
  "config": {
    "connection_id": "pi-credential-xxxx",
    "mailbox_emails": [
      "billing@example.com",
      "support@example.com"
    ],
    "folder": "inbox",
    "polling_interval": 60,
    "attachment_threshold": 5,
    "max_emails_per_cycle": 50
  }
}
```

### Envelope

```json
{
  "ok": true,
  "data": {
    "messages": [
      {
        "id": "AAMkAGI2TG93AAA=",
        "subject": "Invoice request",
        "from": "ana@example.com",
        "to": [
          "billing@example.com"
        ],
        "cc": [],
        "receivedDateTime": "2026-11-26T14:02:51Z",
        "body": "<html><body><p>Please send the invoice.</p></body></html>",
        "bodyContentType": "html",
        "bodyPreview": "Please send the invoice.",
        "isRead": false,
        "hasAttachments": false,
        "importance": "normal",
        "conversationId": "AAQkAGI2TG93CCC=",
        "internetMessageId": "<CAF1x2y3z@mail.example.com>",
        "mailbox_email": "billing@example.com"
      }
    ],
    "count": 1,
    "hasNewEmails": true,
    "lastTimeChecked": "2026-11-26T14:03:00.120Z",
    "id": "AAMkAGI2TG93AAA=",
    "subject": "Invoice request",
    "from": "ana@example.com",
    "to": [
      "billing@example.com"
    ],
    "cc": [],
    "receivedDateTime": "2026-11-26T14:02:51Z",
    "body": "<html><body><p>Please send the invoice.</p></body></html>",
    "bodyContentType": "html",
    "bodyPreview": "Please send the invoice.",
    "isRead": false,
    "hasAttachments": false,
    "importance": "normal",
    "conversationId": "AAQkAGI2TG93CCC=",
    "internetMessageId": "<CAF1x2y3z@mail.example.com>",
    "mailbox_email": "billing@example.com"
  },
  "port": "out",
  "meta": {
    "trigger_state": {
      "perMailbox": {
        "billing@example.com": {
          "lastTimeChecked": "2026-11-26T14:03:00.120Z"
        },
        "support@example.com": {
          "lastTimeChecked": "2026-11-26T14:03:00.120Z"
        }
      }
    }
  }
}
```

## Output ports (behaviour in the code)

### `out`

At least one mailbox had new mail and the first message is below the attachment threshold.

```json
{
  "messages": [
    {
      "id": "AAMkAGI2TG93AAA=",
      "subject": "Invoice request",
      "from": "ana@example.com",
      "to": [
        "billing@example.com"
      ],
      "cc": [],
      "receivedDateTime": "2026-11-26T14:02:51Z",
      "body": "<html><body><p>Please send the invoice.</p></body></html>",
      "bodyContentType": "html",
      "bodyPreview": "Please send the invoice.",
      "isRead": false,
      "hasAttachments": false,
      "importance": "normal",
      "conversationId": "AAQkAGI2TG93CCC=",
      "internetMessageId": "<CAF1x2y3z@mail.example.com>",
      "mailbox_email": "billing@example.com"
    }
  ],
  "count": 1,
  "hasNewEmails": true,
  "lastTimeChecked": "2026-11-26T14:03:00.120Z",
  "id": "AAMkAGI2TG93AAA=",
  "subject": "Invoice request",
  "from": "ana@example.com",
  "to": [
    "billing@example.com"
  ],
  "cc": [],
  "receivedDateTime": "2026-11-26T14:02:51Z",
  "body": "<html><body><p>Please send the invoice.</p></body></html>",
  "bodyContentType": "html",
  "bodyPreview": "Please send the invoice.",
  "isRead": false,
  "hasAttachments": false,
  "importance": "normal",
  "conversationId": "AAQkAGI2TG93CCC=",
  "internetMessageId": "<CAF1x2y3z@mail.example.com>",
  "mailbox_email": "billing@example.com"
}
```

### `heavy_attachments`

The first message has `attachment_threshold` attachments or more. Same shape as `out`, with `attachmentCount` on the message.

```json
{
  "messages": [
    {
      "id": "AAMkAGI2TG94AAA=",
      "subject": "Scanned documents",
      "from": "ana@example.com",
      "to": [
        "support@example.com"
      ],
      "cc": [],
      "receivedDateTime": "2026-11-26T14:03:40Z",
      "body": "<html><body><p>Attached.</p></body></html>",
      "bodyContentType": "html",
      "bodyPreview": "Attached.",
      "isRead": false,
      "hasAttachments": true,
      "importance": "normal",
      "conversationId": "AAQkAGI2TG94CCC=",
      "internetMessageId": "<CAF4u5v6w@mail.example.com>",
      "mailbox_email": "support@example.com",
      "attachmentCount": 7
    }
  ],
  "count": 1,
  "hasNewEmails": true,
  "lastTimeChecked": "2026-11-26T14:04:00.087Z",
  "id": "AAMkAGI2TG94AAA=",
  "subject": "Scanned documents",
  "from": "ana@example.com",
  "to": [
    "support@example.com"
  ],
  "cc": [],
  "receivedDateTime": "2026-11-26T14:03:40Z",
  "body": "<html><body><p>Attached.</p></body></html>",
  "bodyContentType": "html",
  "bodyPreview": "Attached.",
  "isRead": false,
  "hasAttachments": true,
  "importance": "normal",
  "conversationId": "AAQkAGI2TG94CCC=",
  "internetMessageId": "<CAF4u5v6w@mail.example.com>",
  "mailbox_email": "support@example.com",
  "attachmentCount": 7
}
```

### `empty`

No mailbox had new mail (scheduled branch), or a manual run waited 30 minutes without mail (then with `timedOut: true` and `polledForMs`).

```json
{
  "messages": [],
  "count": 0,
  "hasNewEmails": false,
  "lastTimeChecked": "2026-11-26T14:33:00.502Z",
  "timedOut": true,
  "polledForMs": 1800381
}
```

### `error`

A validation failed (the output is the envelope `{ ok, errors, port }`) or, in a manual run, a mailbox query failed (the output is `{ error }`).

```json
{
  "ok": false,
  "errors": [
    "At least one mailbox email is required"
  ],
  "port": "error"
}
```

## Behaviour in the code

- `mailbox_emails`: Accepts an array or a comma-separated string. Every mailbox must be readable by the credential with application permission `Mail.Read`.
- `attachment_threshold`: Evaluated on the first message only, even when several arrived.
- `polling_interval`: Wait between passes in a manual run. The 60-second minimum is not enforced, and the backend scheduler does not use it for this node.

## Errors

| Message | Port | Cause and fix |
| --- | --- | --- |
| `Microsoft 365 credential is required` | `error` | `connection_id` is empty. |
| `At least one mailbox email is required` | `error` | `mailbox_emails` is empty or contains no valid string. |
| `Failed to resolve Microsoft 365 access token` | `error` | The credential could not be resolved or the token request failed. |
| `Poll failed: <message>` | `error` | Manual run: the query of one of the mailboxes failed (for example 403 without `Mail.Read` on that mailbox). |

## Notes and limits

- The definition says it fires once per email per mailbox; the code fires once per run. All the messages found are in `messages` and only the first is copied to the root, and the last-check times advance for all of them, so iterate `messages` (for example with `flow.split`) instead of relying on the root fields.
- Unlike the single-mailbox trigger, a manual run starts from the stored per-mailbox last-check times when they exist, so it also returns mail received since the previous run.
- With sample data the engine skips this node and passes the sample input on `out`. A manual run blocks for up to 30 minutes.


## Contracts (JSON Schema)

### All (`*.definition.js`)

```json
{
  "slug": "connectors.microsoft.outlook.trigger.multi",
  "name": "Outlook - Multi-Mailbox Trigger",
  "category": "integrations",
  "version": "1.0.0",
  "description": "Triggers when a new email arrives in ANY of multiple Microsoft Outlook mailboxes.\n\n  Enterprise-grade multi-tenant mailbox listener. A single trigger node watches a list of mailboxes in parallel and fires **one workflow execution per new email**, with the originating mailbox identified in the payload. Ideal for shared inbox architectures (PQRS, support, legal intake, HR) where several functional mailboxes must feed the same triage workflow.\n\n  **How it works:**\n  - On each polling cycle, the trigger checks ALL configured mailboxes in parallel (one Graph API call per mailbox).\n  - Every new email found is emitted as an independent trigger fire — if 3 mailboxes each receive 1 new email in the same cycle, the workflow executes 3 times.\n  - The originating mailbox is exposed as `mailbox_email` in the output payload so downstream nodes can route or tag accordingly.\n  - `lastTimeChecked` state is tracked **per mailbox** independently (so a slow-polling mailbox does not block others).\n  - If an email has many attachments, the `heavy_attachments` port is used instead of `out` for dedicated downstream processing.\n\n  **When to prefer this over the single-mailbox trigger:**\n  - You have 2+ shared inboxes that should run the same workflow.\n  - You want to avoid maintaining N parallel workflows (one per mailbox) that all do the same thing.\n  - You need consistent state tracking across a mailbox cluster.\n\n  **When NOT to prefer this:**\n  - You have >10K emails/month and need sub-second latency — use Graph webhooks + a queue (e.g. Service Bus) instead.\n  - Each mailbox has materially different downstream logic — use separate workflows.",
  "capabilities": [
    "email",
    "microsoft",
    "outlook",
    "trigger",
    "multi-mailbox",
    "shared-inbox"
  ],
  "group": [
    {
      "key": "microsoft",
      "name": "Microsoft",
      "icon_url": "/icons/integrations/microsoft/microsoft.svg"
    },
    {
      "key": "microsoft365",
      "name": "Microsoft 365",
      "icon_url": "/icons/integrations/microsoft/microsoft365.svg"
    }
  ],
  "icon_url": "/icons/integrations/microsoft/outlook.svg",
  "config_schema": {
    "type": "object",
    "properties": {
      "connection_id": {
        "type": "string",
        "title": "Microsoft 365 Credential",
        "description": "Credential for Microsoft Graph API access. The app registration must have Mail.Read permission (Application) on all monitored mailboxes. Accepts credentials of type `oauth2` (access + refresh token), `service-account` (tenant id + client id + client secret), or `object` (advanced Graph config).",
        "ui_widget": "connection_picker",
        "ui_options": {
          "credential_types": [
            "oauth2",
            "service-account",
            "object"
          ],
          "types": [
            "outlook",
            "microsoft365",
            "oauth2"
          ]
        }
      },
      "mailbox_emails": {
        "type": "array",
        "title": "Mailbox Emails",
        "description": "List of mailbox email addresses to monitor. Each email address must be accessible by the configured credential.",
        "items": {
          "type": "string",
          "format": "expression"
        }
      },
      "folder": {
        "type": "string",
        "title": "Folder",
        "enum": [
          "inbox",
          "sentitems",
          "drafts",
          "deleteditems",
          "junkemail",
          "archive"
        ],
        "default": "inbox",
        "description": "The mail folder to watch for new messages (same folder applies to all mailboxes)."
      },
      "polling_interval": {
        "type": "number",
        "title": "Polling Interval (seconds)",
        "default": 60,
        "description": "How often to check for new emails. Minimum 60 seconds. Each mailbox is checked in parallel per cycle."
      },
      "attachment_threshold": {
        "type": "number",
        "title": "Heavy Attachments Threshold",
        "default": 5,
        "description": "Number of attachments at or above which the email routes to the heavy_attachments port instead of out."
      },
      "max_emails_per_cycle": {
        "type": "number",
        "title": "Max Emails Per Mailbox Per Cycle",
        "default": 50,
        "description": "Graph API $top value. Cap on how many new emails per mailbox are fetched in a single polling cycle (rest wait for next cycle)."
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    },
    "required": [
      "connection_id",
      "mailbox_emails"
    ]
  },
  "input_contract_schema": null,
  "output_contract_schema": {
    "type": "object",
    "description": "The incoming email data, with the originating mailbox surfaced for routing.",
    "properties": {
      "id": {
        "type": "string",
        "description": "The Graph message ID. Use this for reply/forward/delete operations."
      },
      "mailbox_email": {
        "type": "string",
        "description": "The mailbox this email was received in. Use this for per-mailbox routing downstream."
      },
      "subject": {
        "type": "string"
      },
      "from": {
        "type": "string",
        "description": "Sender email address."
      },
      "to": {
        "type": "array",
        "description": "Recipient email addresses."
      },
      "cc": {
        "type": "array"
      },
      "receivedDateTime": {
        "type": "string",
        "format": "date-time"
      },
      "body": {
        "type": "string",
        "description": "Email body content."
      },
      "bodyContentType": {
        "type": "string"
      },
      "bodyPreview": {
        "type": "string"
      },
      "isRead": {
        "type": "boolean"
      },
      "hasAttachments": {
        "type": "boolean"
      },
      "attachmentCount": {
        "type": "number"
      },
      "importance": {
        "type": "string"
      },
      "conversationId": {
        "type": "string"
      },
      "internetMessageId": {
        "type": "string"
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "New Email",
      "is_default": true,
      "description": "A new email was received (below attachment threshold). Fires once per email per mailbox."
    },
    {
      "port_id": "heavy_attachments",
      "label": "Heavy Attachments",
      "description": "Email has attachments at or above the threshold. Route to a dedicated attachment processing node."
    },
    {
      "port_id": "empty",
      "label": "No New Emails",
      "description": "No new emails found in any monitored mailbox in this polling cycle."
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Failed to fetch emails or authentication error."
    }
  ],
  "execution_mode": "async",
  "tags": [
    "email",
    "microsoft",
    "outlook",
    "trigger",
    "multi-mailbox",
    "shared-inbox",
    "premium"
  ],
  "is_stateful": true,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://me.veripass.com/sommatic",
      "logo_url": null
    }
  }
}
```

### config_schema

```json
{
  "type": "object",
  "properties": {
    "connection_id": {
      "type": "string",
      "title": "Microsoft 365 Credential",
      "description": "Credential for Microsoft Graph API access. The app registration must have Mail.Read permission (Application) on all monitored mailboxes. Accepts credentials of type `oauth2` (access + refresh token), `service-account` (tenant id + client id + client secret), or `object` (advanced Graph config).",
      "ui_widget": "connection_picker",
      "ui_options": {
        "credential_types": [
          "oauth2",
          "service-account",
          "object"
        ],
        "types": [
          "outlook",
          "microsoft365",
          "oauth2"
        ]
      }
    },
    "mailbox_emails": {
      "type": "array",
      "title": "Mailbox Emails",
      "description": "List of mailbox email addresses to monitor. Each email address must be accessible by the configured credential.",
      "items": {
        "type": "string",
        "format": "expression"
      }
    },
    "folder": {
      "type": "string",
      "title": "Folder",
      "enum": [
        "inbox",
        "sentitems",
        "drafts",
        "deleteditems",
        "junkemail",
        "archive"
      ],
      "default": "inbox",
      "description": "The mail folder to watch for new messages (same folder applies to all mailboxes)."
    },
    "polling_interval": {
      "type": "number",
      "title": "Polling Interval (seconds)",
      "default": 60,
      "description": "How often to check for new emails. Minimum 60 seconds. Each mailbox is checked in parallel per cycle."
    },
    "attachment_threshold": {
      "type": "number",
      "title": "Heavy Attachments Threshold",
      "default": 5,
      "description": "Number of attachments at or above which the email routes to the heavy_attachments port instead of out."
    },
    "max_emails_per_cycle": {
      "type": "number",
      "title": "Max Emails Per Mailbox Per Cycle",
      "default": 50,
      "description": "Graph API $top value. Cap on how many new emails per mailbox are fetched in a single polling cycle (rest wait for next cycle)."
    },
    "execution": {
      "type": "object",
      "title": "Execution Settings",
      "properties": {
        "alwaysOutputData": {
          "type": "boolean",
          "title": "Always Output Data",
          "description": "Always output data, even on error (if configured).",
          "default": false
        },
        "retryOnFail": {
          "type": "boolean",
          "title": "Retry On Fail",
          "description": "Retry the execution if it fails.",
          "default": false
        },
        "maxTries": {
          "type": "integer",
          "title": "Max Retries",
          "description": "Number of retries.",
          "default": 3,
          "displayOptions": {
            "show": {
              "retryOnFail": [
                true
              ]
            }
          }
        },
        "waitBetweenTries": {
          "type": "integer",
          "title": "Wait Between Retries (ms)",
          "default": 1000,
          "displayOptions": {
            "show": {
              "retryOnFail": [
                true
              ]
            }
          }
        },
        "continueOnFail": {
          "type": "boolean",
          "title": "Continue On Fail",
          "description": "Do not crash workflow on error.",
          "default": false
        },
        "timeout_ms": {
          "type": "integer",
          "title": "Timeout (ms)",
          "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
          "default": 300000
        }
      }
    }
  },
  "required": [
    "connection_id",
    "mailbox_emails"
  ]
}
```

### output_contract_schema

```json
{
  "type": "object",
  "description": "The incoming email data, with the originating mailbox surfaced for routing.",
  "properties": {
    "id": {
      "type": "string",
      "description": "The Graph message ID. Use this for reply/forward/delete operations."
    },
    "mailbox_email": {
      "type": "string",
      "description": "The mailbox this email was received in. Use this for per-mailbox routing downstream."
    },
    "subject": {
      "type": "string"
    },
    "from": {
      "type": "string",
      "description": "Sender email address."
    },
    "to": {
      "type": "array",
      "description": "Recipient email addresses."
    },
    "cc": {
      "type": "array"
    },
    "receivedDateTime": {
      "type": "string",
      "format": "date-time"
    },
    "body": {
      "type": "string",
      "description": "Email body content."
    },
    "bodyContentType": {
      "type": "string"
    },
    "bodyPreview": {
      "type": "string"
    },
    "isRead": {
      "type": "boolean"
    },
    "hasAttachments": {
      "type": "boolean"
    },
    "attachmentCount": {
      "type": "number"
    },
    "importance": {
      "type": "string"
    },
    "conversationId": {
      "type": "string"
    },
    "internetMessageId": {
      "type": "string"
    }
  }
}
```

### ports

```json
[
  {
    "port_id": "out",
    "label": "New Email",
    "is_default": true,
    "description": "A new email was received (below attachment threshold). Fires once per email per mailbox."
  },
  {
    "port_id": "heavy_attachments",
    "label": "Heavy Attachments",
    "description": "Email has attachments at or above the threshold. Route to a dedicated attachment processing node."
  },
  {
    "port_id": "empty",
    "label": "No New Emails",
    "description": "No new emails found in any monitored mailbox in this polling cycle."
  },
  {
    "port_id": "error",
    "label": "Error",
    "description": "Failed to fetch emails or authentication error."
  }
]
```
