# Outlook - Mail

> Send, read, and manage emails through Microsoft Outlook via the Microsoft Graph API.

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

- Slug: `connectors.microsoft.outlook.mail`
- Family: Connectors
- Version: 1.0.0
- Status: Available
- Execution: async

Send, read, and manage emails through Microsoft Outlook via the Microsoft Graph API.

Connect your Microsoft 365 account and automate email operations — send notifications, process incoming mail, manage drafts, and more.

**Operations:**
- **Send:** Compose and send a new email with recipients, subject, body, and optional attachments.
- **Reply:** Reply to an existing email by message ID.
- **Get:** Retrieve a specific email by message ID.
- **List:** List emails from a folder with optional filtering.
- **Delete:** Delete an email by message ID.
- **Forward:** Forward an email to new recipients.

## Configuration

- `connection_id` (string, required): Credential for Microsoft Graph API access. Accepts credentials of type `oauth2` (access + refresh token), `service-account` (tenant id + client id + client secret), or `object` (advanced Graph config).
- `mailbox_mode` (string, optional): Token owner: uses the mailbox of the account that generated the credential. Other mailbox: specify an email address (requires Application permissions in Azure AD). Default: `token_owner`. Allowed values: `token_owner`, `other`.
- `mailbox_email` (string, optional, accepts expressions): Email address of the mailbox to operate on (e.g., support@organization.com). Shown when: mailbox_mode = `other`.
- `operation` (string, required): The email operation to perform. Default: `send`. Allowed values: `send`, `reply`, `get`, `list`, `delete`, `forward`, `get_attachments`.
- `to` (string, optional, accepts expressions): Comma-separated emails to override the default reply recipient (which Graph sets to the original sender). Use to route the reply to e.g. the court mailbox instead of the natural-person who forwarded the case. Triggers enriched 4-call flow. Shown when: operation = `reply`.
- `cc` (string, optional, accepts expressions): Comma-separated emails to receive a visible copy of the reply. Shown when: operation = `reply`.
- `bcc` (string, optional, accepts expressions): Comma-separated emails to receive a blind copy of the reply. Triggers enriched 4-call flow (createReply → PATCH → send) and preserves the original message quote. Shown when: operation = `reply`.
- `subject` (string, optional, accepts expressions): Email subject line. Shown when: operation = `send`.
- `body` (string, optional, accepts expressions): Email body content. Supports HTML. Shown when: operation = `send` | `reply`.
- `content_type` (string, optional): Whether the body is plain text or HTML. Default: `html`. Allowed values: `text`, `html`. Shown when: operation = `send` | `reply`.
- `reply_target` (string, optional): Incoming message: automatically replies to the email received from the previous node. Custom: specify a message ID manually. Default: `incoming`. Allowed values: `incoming`, `custom`. Shown when: operation = `reply`.
- `custom_message_id` (string, optional, accepts expressions): The ID of the email to reply to. Shown when: operation = `reply`; reply_target = `custom`.
- `message_id` (string, optional, accepts expressions): The ID of the email message. Shown when: operation = `get` | `delete` | `forward`.
- `forward_subject` (string, optional, accepts expressions): Custom subject for the forwarded message. If empty, Outlook prefixes "FW: " to the original subject (default Graph behavior). Shown when: operation = `forward`.
- `forward_importance` (string, optional): Importance flag for the forwarded message. Set to "high" to mark as urgent. Empty = default (normal). Allowed values: ``, `low`, `normal`, `high`. Shown when: operation = `forward`.
- `timezone` (string, optional): Optional Windows time zone name used for the time shown in the quoted header of the forwarded message (e.g. "SA Pacific Standard Time" for Colombia). Empty = UTC (default Graph behavior). Shown when: operation = `forward`.
- `language` (string, optional): Optional language tag for the labels of the quoted header of the forwarded message (e.g. "es-CO" shows De / Enviado / Para / Asunto). Empty = English (default Graph behavior). Day and month names stay in English. Shown when: operation = `forward`.
- `folder` (string, optional): The mail folder to list messages from. Default: `inbox`. Allowed values: `inbox`, `sentitems`, `drafts`, `deleteditems`, `junkemail`, `archive`. Shown when: operation = `list`.
- `limit` (number, optional): Maximum number of messages to return. Default: `10`. Shown when: operation = `list`.
- `filter` (string, optional, accepts expressions): OData filter expression (e.g., "isRead eq false"). Shown when: operation = `list`.

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): Operation completed successfully.
- `error`: Operation failed (auth error, invalid message ID, API error).

## Input contract

- `connection_id` (string, required)
- `operation` (string, required)
- `to` (string, optional)
- `subject` (string, optional)
- `body` (string, optional)
- `message_id` (string, optional)

## Output contract

- `result` (object, optional): Operation result from Microsoft Graph API.
- `operation` (string, optional): The operation that was performed.

## In expressions

What a later node can read from this node's output with `$("Outlook - Mail").item.json.<path>` (write your node's label instead of `Outlook - Mail`). **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 - Mail").item.json.result` (object) = `{…}`: Operation result from Microsoft Graph API.
- `$("Outlook - Mail").item.json.operation` (string) = `"send"`: The operation that was performed.
- `$("Outlook - Mail").item.json.result.sent` (boolean) = `true` (Not suggested by the editor)
- `$("Outlook - Mail").item.json.result.status` (number) = `202` (Not suggested by the editor)


## How it works

Sends, replies to, forwards, reads, lists or deletes Outlook messages, or reads a message's attachments, through Microsoft Graph. The result of the chosen operation is returned under `result`.

1. Resolves the node config and requires `connection_id`. Gets a Graph token: with `client_id`, `client_secret` and `tenant_id` in the credential secret it requests an app-only token; otherwise it uses the secret's `token` or `access_token` as is.
2. Targets `/users/<mailbox_email>` when `mailbox_mode` is `other`, otherwise `/me`, and dispatches on `operation` (default `send`).
3. `send` requires `to` and `subject`, splits `to`, `cc` and `bcc` on commas and posts `sendMail` with an HTML or text body (`content_type`).
4. `reply` uses `custom_message_id` when `reply_target` is `custom`, else the incoming item's `id`, else `message_id`. Without overrides it posts `/reply` with `body` as the comment. With `to`, `cc`, `bcc` or `include_quoted_original: false` it creates a reply draft, sets recipients and body (your body, then `<hr/>`, then the quoted original, unless the quote is disabled) and sends it.
5. `forward` requires `message_id` and `to`. Without overrides it posts `/forward`. With `forward_subject`, `forward_importance`, `timezone`, `language`, `cc` or `bcc` it creates a forward draft (sending `Prefer: outlook.timezone` and `Accept-Language` for the quoted header), patches it, sends it and returns its `conversation_id` and `internet_message_id` (from the draft, or from up to 5 Sent Items lookups 1.5 s apart).
6. `get` returns the Graph message for `message_id`; `list` returns up to `limit` messages of `folder`, newest first, optionally filtered by the OData `filter`; `delete` deletes `message_id`; `get_attachments` returns the attachments of the incoming item's `id` (or `message_id`).

## In a workflow

### Node

```json
{
  "node_id": "node-confirm-order",
  "label": "Send confirmation",
  "operator_slug": "connectors.microsoft.outlook.mail",
  "operator_version": "1.0.0",
  "config": {
    "connection_id": "pi-credential-xxxx",
    "mailbox_mode": "other",
    "mailbox_email": "orders@example.com",
    "operation": "send",
    "to": "{{ $json.customer_email }}",
    "subject": "Order {{ $json.order_id }} received",
    "body": "<p>Thanks, we received your order.</p>",
    "content_type": "html"
  }
}
```

### Envelope

```json
{
  "ok": true,
  "data": {
    "result": {
      "sent": true,
      "status": 202
    },
    "operation": "send"
  },
  "port": "out"
}
```

## Output ports (behaviour in the code)

### `out`

The operation succeeded. The output is `{ result, operation }`, except `get_attachments`, which returns `{ attachments, count }` plus `attachment` when there is exactly one.

```json
{
  "result": {
    "sent": true,
    "status": 202
  },
  "operation": "send"
}
```

### `error`

A validation failed (the output is the envelope `{ ok, errors, port }`) or a Graph call failed (the output is `{ error, response }` with Graph's error body).

```json
{
  "ok": false,
  "errors": [
    "Recipient (to) is required for send operation"
  ],
  "port": "error"
}
```

## Behaviour in the code

- `to`: `to`, `cc` and `bcc` are declared twice in the definition, and the second declaration (reply overrides) wins, so the form only shows them for `reply`. The worker still reads `to`, `cc` and `bcc` for `send` and `forward` too.
- `include_quoted_original`: Undeclared. Default `true`. `false` makes `reply` send only `body` as HTML, without Graph's quoted original.
- `content_type`: Only used by `send`. Replies and forwards keep the content type of Graph's draft.
- `attachment_filter`: Undeclared (alias `filter_content_type`). For `get_attachments`, keeps attachments whose content type starts with this value, case-insensitive.
- `timezone`: Forward only: a Windows time zone name for the time in the quoted header. `language` (a language tag such as `es-ES`) sets its labels. Either one forces the draft-based forward.

## Errors

| Message | Port | Cause and fix |
| --- | --- | --- |
| `Microsoft 365 credential is required` | `error` | `connection_id` is empty. |
| `Failed to resolve Microsoft 365 access token` | `error` | The credential could not be resolved, the token request failed, or the secret has neither client credentials nor a token. |
| `Unknown operation: <operation>` | `error` | `operation` is not send, reply, get, list, delete, forward or get_attachments. |
| `Recipient (to) is required for <send\|forward> operation` | `error` | `to` is empty. `Subject is required for send operation` is the equivalent check for `subject`. |
| `Message ID is required for <get\|delete\|forward> operation` | `error` | `message_id` is empty. Reply and get_attachments return a longer variant that mentions the previous node. |
| `createReply did not return a draft message id` | `error` | Graph did not create the reply draft. `createForward did not return a draft message id` is the forward equivalent. |
| `Request failed with status code <status>` | `error` | Graph rejected the call (unknown message, invalid OData filter, missing `Mail.Send` / `Mail.ReadWrite` permission, expired token). See `response` for Graph's error. |

## Notes and limits

- `list` and `get_attachments` read a single Graph page; `get_attachments` includes base64 `contentBytes` for every attachment.
- Sending operations are not idempotent and the node does not retry them; re-running a failed workflow can send a message twice.
- An OAuth access token stored in the credential is never refreshed. App-only tokens need `mailbox_mode: other`, because they have no `/me`.
- Draft-based replies and forwards return `draft_id`, `conversation_id` and `internet_message_id`, which `connectors.microsoft.outlook.message.category` can use to label the sent copy.


## Contracts (JSON Schema)

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

```json
{
  "slug": "connectors.microsoft.outlook.mail",
  "name": "Outlook - Mail",
  "category": "integrations",
  "version": "1.0.0",
  "description": "Send, read, and manage emails through Microsoft Outlook via the Microsoft Graph API.\n\n  Connect your Microsoft 365 account and automate email operations — send notifications, process incoming mail, manage drafts, and more.\n\n  **Operations:**\n  - **Send:** Compose and send a new email with recipients, subject, body, and optional attachments.\n  - **Reply:** Reply to an existing email by message ID.\n  - **Get:** Retrieve a specific email by message ID.\n  - **List:** List emails from a folder with optional filtering.\n  - **Delete:** Delete an email by message ID.\n  - **Forward:** Forward an email to new recipients.",
  "capabilities": [
    "email",
    "microsoft",
    "outlook",
    "office365",
    "graph-api"
  ],
  "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. 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_mode": {
        "type": "string",
        "title": "Mailbox",
        "enum": [
          "token_owner",
          "other"
        ],
        "default": "token_owner",
        "description": "Token owner: uses the mailbox of the account that generated the credential. Other mailbox: specify an email address (requires Application permissions in Azure AD)."
      },
      "mailbox_email": {
        "type": "string",
        "title": "Mailbox Email",
        "description": "Email address of the mailbox to operate on (e.g., support@organization.com).",
        "format": "expression",
        "displayOptions": {
          "show": {
            "mailbox_mode": [
              "other"
            ]
          }
        }
      },
      "operation": {
        "type": "string",
        "title": "Operation",
        "enum": [
          "send",
          "reply",
          "get",
          "list",
          "delete",
          "forward",
          "get_attachments"
        ],
        "default": "send",
        "description": "The email operation to perform."
      },
      "to": {
        "type": "string",
        "title": "To (Reply override)",
        "description": "Comma-separated emails to override the default reply recipient (which Graph sets to the original sender). Use to route the reply to e.g. the court mailbox instead of the natural-person who forwarded the case. Triggers enriched 4-call flow.",
        "format": "expression",
        "displayOptions": {
          "show": {
            "operation": [
              "reply"
            ]
          }
        }
      },
      "cc": {
        "type": "string",
        "title": "CC (Reply)",
        "description": "Comma-separated emails to receive a visible copy of the reply.",
        "format": "expression",
        "displayOptions": {
          "show": {
            "operation": [
              "reply"
            ]
          }
        }
      },
      "bcc": {
        "type": "string",
        "title": "BCC (Reply)",
        "description": "Comma-separated emails to receive a blind copy of the reply. Triggers enriched 4-call flow (createReply → PATCH → send) and preserves the original message quote.",
        "format": "expression",
        "displayOptions": {
          "show": {
            "operation": [
              "reply"
            ]
          }
        }
      },
      "subject": {
        "type": "string",
        "title": "Subject",
        "description": "Email subject line.",
        "format": "expression",
        "displayOptions": {
          "show": {
            "operation": [
              "send"
            ]
          }
        }
      },
      "body": {
        "type": "string",
        "title": "Body",
        "description": "Email body content. Supports HTML.",
        "format": "expression",
        "displayOptions": {
          "show": {
            "operation": [
              "send",
              "reply"
            ]
          }
        }
      },
      "content_type": {
        "type": "string",
        "title": "Content Type",
        "enum": [
          "text",
          "html"
        ],
        "default": "html",
        "description": "Whether the body is plain text or HTML.",
        "displayOptions": {
          "show": {
            "operation": [
              "send",
              "reply"
            ]
          }
        }
      },
      "reply_target": {
        "type": "string",
        "title": "Reply To",
        "enum": [
          "incoming",
          "custom"
        ],
        "default": "incoming",
        "description": "Incoming message: automatically replies to the email received from the previous node. Custom: specify a message ID manually.",
        "displayOptions": {
          "show": {
            "operation": [
              "reply"
            ]
          }
        }
      },
      "custom_message_id": {
        "type": "string",
        "title": "Message ID",
        "description": "The ID of the email to reply to.",
        "format": "expression",
        "displayOptions": {
          "show": {
            "operation": [
              "reply"
            ],
            "reply_target": [
              "custom"
            ]
          }
        }
      },
      "message_id": {
        "type": "string",
        "title": "Message ID",
        "description": "The ID of the email message.",
        "format": "expression",
        "displayOptions": {
          "show": {
            "operation": [
              "get",
              "delete",
              "forward"
            ]
          }
        }
      },
      "forward_subject": {
        "type": "string",
        "title": "Forward Subject (override)",
        "description": "Custom subject for the forwarded message. If empty, Outlook prefixes \"FW: \" to the original subject (default Graph behavior).",
        "format": "expression",
        "displayOptions": {
          "show": {
            "operation": [
              "forward"
            ]
          }
        }
      },
      "forward_importance": {
        "type": "string",
        "title": "Forward Importance",
        "enum": [
          "",
          "low",
          "normal",
          "high"
        ],
        "default": "",
        "description": "Importance flag for the forwarded message. Set to \"high\" to mark as urgent. Empty = default (normal).",
        "displayOptions": {
          "show": {
            "operation": [
              "forward"
            ]
          }
        }
      },
      "timezone": {
        "type": "string",
        "title": "Forward Time Zone",
        "description": "Optional Windows time zone name used for the time shown in the quoted header of the forwarded message (e.g. \"SA Pacific Standard Time\" for Colombia). Empty = UTC (default Graph behavior).",
        "default": "",
        "displayOptions": {
          "show": {
            "operation": [
              "forward"
            ]
          }
        }
      },
      "language": {
        "type": "string",
        "title": "Forward Language",
        "description": "Optional language tag for the labels of the quoted header of the forwarded message (e.g. \"es-CO\" shows De / Enviado / Para / Asunto). Empty = English (default Graph behavior). Day and month names stay in English.",
        "default": "",
        "displayOptions": {
          "show": {
            "operation": [
              "forward"
            ]
          }
        }
      },
      "folder": {
        "type": "string",
        "title": "Folder",
        "enum": [
          "inbox",
          "sentitems",
          "drafts",
          "deleteditems",
          "junkemail",
          "archive"
        ],
        "default": "inbox",
        "description": "The mail folder to list messages from.",
        "displayOptions": {
          "show": {
            "operation": [
              "list"
            ]
          }
        }
      },
      "limit": {
        "type": "number",
        "title": "Limit",
        "default": 10,
        "description": "Maximum number of messages to return.",
        "displayOptions": {
          "show": {
            "operation": [
              "list"
            ]
          }
        }
      },
      "filter": {
        "type": "string",
        "title": "Filter",
        "description": "OData filter expression (e.g., \"isRead eq false\").",
        "format": "expression",
        "displayOptions": {
          "show": {
            "operation": [
              "list"
            ]
          }
        }
      },
      "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",
      "operation"
    ]
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "connection_id": {
        "type": "string"
      },
      "operation": {
        "type": "string"
      },
      "to": {
        "type": "string"
      },
      "subject": {
        "type": "string"
      },
      "body": {
        "type": "string"
      },
      "message_id": {
        "type": "string"
      }
    },
    "required": [
      "connection_id",
      "operation"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "result": {
        "type": "object",
        "description": "Operation result from Microsoft Graph API."
      },
      "operation": {
        "type": "string",
        "description": "The operation that was performed."
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "Success",
      "description": "Operation completed successfully.",
      "is_default": true,
      "supports_condition": true
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Operation failed (auth error, invalid message ID, API error).",
      "is_default": false,
      "supports_condition": true
    }
  ],
  "execution_mode": "async",
  "required_resources": [],
  "compatible_worker_pools": [
    "standard-io",
    "cloud-io"
  ],
  "tags": [
    "email",
    "microsoft",
    "outlook",
    "office365",
    "send",
    "connector"
  ],
  "is_stateful": false,
  "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. 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_mode": {
      "type": "string",
      "title": "Mailbox",
      "enum": [
        "token_owner",
        "other"
      ],
      "default": "token_owner",
      "description": "Token owner: uses the mailbox of the account that generated the credential. Other mailbox: specify an email address (requires Application permissions in Azure AD)."
    },
    "mailbox_email": {
      "type": "string",
      "title": "Mailbox Email",
      "description": "Email address of the mailbox to operate on (e.g., support@organization.com).",
      "format": "expression",
      "displayOptions": {
        "show": {
          "mailbox_mode": [
            "other"
          ]
        }
      }
    },
    "operation": {
      "type": "string",
      "title": "Operation",
      "enum": [
        "send",
        "reply",
        "get",
        "list",
        "delete",
        "forward",
        "get_attachments"
      ],
      "default": "send",
      "description": "The email operation to perform."
    },
    "to": {
      "type": "string",
      "title": "To (Reply override)",
      "description": "Comma-separated emails to override the default reply recipient (which Graph sets to the original sender). Use to route the reply to e.g. the court mailbox instead of the natural-person who forwarded the case. Triggers enriched 4-call flow.",
      "format": "expression",
      "displayOptions": {
        "show": {
          "operation": [
            "reply"
          ]
        }
      }
    },
    "cc": {
      "type": "string",
      "title": "CC (Reply)",
      "description": "Comma-separated emails to receive a visible copy of the reply.",
      "format": "expression",
      "displayOptions": {
        "show": {
          "operation": [
            "reply"
          ]
        }
      }
    },
    "bcc": {
      "type": "string",
      "title": "BCC (Reply)",
      "description": "Comma-separated emails to receive a blind copy of the reply. Triggers enriched 4-call flow (createReply → PATCH → send) and preserves the original message quote.",
      "format": "expression",
      "displayOptions": {
        "show": {
          "operation": [
            "reply"
          ]
        }
      }
    },
    "subject": {
      "type": "string",
      "title": "Subject",
      "description": "Email subject line.",
      "format": "expression",
      "displayOptions": {
        "show": {
          "operation": [
            "send"
          ]
        }
      }
    },
    "body": {
      "type": "string",
      "title": "Body",
      "description": "Email body content. Supports HTML.",
      "format": "expression",
      "displayOptions": {
        "show": {
          "operation": [
            "send",
            "reply"
          ]
        }
      }
    },
    "content_type": {
      "type": "string",
      "title": "Content Type",
      "enum": [
        "text",
        "html"
      ],
      "default": "html",
      "description": "Whether the body is plain text or HTML.",
      "displayOptions": {
        "show": {
          "operation": [
            "send",
            "reply"
          ]
        }
      }
    },
    "reply_target": {
      "type": "string",
      "title": "Reply To",
      "enum": [
        "incoming",
        "custom"
      ],
      "default": "incoming",
      "description": "Incoming message: automatically replies to the email received from the previous node. Custom: specify a message ID manually.",
      "displayOptions": {
        "show": {
          "operation": [
            "reply"
          ]
        }
      }
    },
    "custom_message_id": {
      "type": "string",
      "title": "Message ID",
      "description": "The ID of the email to reply to.",
      "format": "expression",
      "displayOptions": {
        "show": {
          "operation": [
            "reply"
          ],
          "reply_target": [
            "custom"
          ]
        }
      }
    },
    "message_id": {
      "type": "string",
      "title": "Message ID",
      "description": "The ID of the email message.",
      "format": "expression",
      "displayOptions": {
        "show": {
          "operation": [
            "get",
            "delete",
            "forward"
          ]
        }
      }
    },
    "forward_subject": {
      "type": "string",
      "title": "Forward Subject (override)",
      "description": "Custom subject for the forwarded message. If empty, Outlook prefixes \"FW: \" to the original subject (default Graph behavior).",
      "format": "expression",
      "displayOptions": {
        "show": {
          "operation": [
            "forward"
          ]
        }
      }
    },
    "forward_importance": {
      "type": "string",
      "title": "Forward Importance",
      "enum": [
        "",
        "low",
        "normal",
        "high"
      ],
      "default": "",
      "description": "Importance flag for the forwarded message. Set to \"high\" to mark as urgent. Empty = default (normal).",
      "displayOptions": {
        "show": {
          "operation": [
            "forward"
          ]
        }
      }
    },
    "timezone": {
      "type": "string",
      "title": "Forward Time Zone",
      "description": "Optional Windows time zone name used for the time shown in the quoted header of the forwarded message (e.g. \"SA Pacific Standard Time\" for Colombia). Empty = UTC (default Graph behavior).",
      "default": "",
      "displayOptions": {
        "show": {
          "operation": [
            "forward"
          ]
        }
      }
    },
    "language": {
      "type": "string",
      "title": "Forward Language",
      "description": "Optional language tag for the labels of the quoted header of the forwarded message (e.g. \"es-CO\" shows De / Enviado / Para / Asunto). Empty = English (default Graph behavior). Day and month names stay in English.",
      "default": "",
      "displayOptions": {
        "show": {
          "operation": [
            "forward"
          ]
        }
      }
    },
    "folder": {
      "type": "string",
      "title": "Folder",
      "enum": [
        "inbox",
        "sentitems",
        "drafts",
        "deleteditems",
        "junkemail",
        "archive"
      ],
      "default": "inbox",
      "description": "The mail folder to list messages from.",
      "displayOptions": {
        "show": {
          "operation": [
            "list"
          ]
        }
      }
    },
    "limit": {
      "type": "number",
      "title": "Limit",
      "default": 10,
      "description": "Maximum number of messages to return.",
      "displayOptions": {
        "show": {
          "operation": [
            "list"
          ]
        }
      }
    },
    "filter": {
      "type": "string",
      "title": "Filter",
      "description": "OData filter expression (e.g., \"isRead eq false\").",
      "format": "expression",
      "displayOptions": {
        "show": {
          "operation": [
            "list"
          ]
        }
      }
    },
    "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",
    "operation"
  ]
}
```

### input_contract_schema

```json
{
  "type": "object",
  "properties": {
    "connection_id": {
      "type": "string"
    },
    "operation": {
      "type": "string"
    },
    "to": {
      "type": "string"
    },
    "subject": {
      "type": "string"
    },
    "body": {
      "type": "string"
    },
    "message_id": {
      "type": "string"
    }
  },
  "required": [
    "connection_id",
    "operation"
  ]
}
```

### output_contract_schema

```json
{
  "type": "object",
  "properties": {
    "result": {
      "type": "object",
      "description": "Operation result from Microsoft Graph API."
    },
    "operation": {
      "type": "string",
      "description": "The operation that was performed."
    }
  }
}
```

### ports

```json
[
  {
    "port_id": "out",
    "label": "Success",
    "description": "Operation completed successfully.",
    "is_default": true,
    "supports_condition": true
  },
  {
    "port_id": "error",
    "label": "Error",
    "description": "Operation failed (auth error, invalid message ID, API error).",
    "is_default": false,
    "supports_condition": true
  }
]
```
