> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/workflow-builder/apps/outlook.md).

# Outlook

Use the **Outlook** node to send and search email. Connect it to other nodes to generate recipients, content, and attachments dynamically.

## Connect Outlook

Most workflows use StackAI's built-in connector. Sign in with your Microsoft account. Your connection inherits your existing permissions and access.

{% stepper %}
{% step %}

### Add an Outlook node

Add an **Outlook** node (or the **On Email Received** trigger) to your workflow.
{% endstep %}

{% step %}

### Add a connection

In the node's connection field, choose **Add new connection** > **Outlook (OAuth2)**.
{% endstep %}

{% step %}

### Sign in

Sign in with your Microsoft account and accept the consent prompt.
{% endstep %}

{% step %}

### Use the connection

The connection is ready to use. No Azure setup is required.
{% endstep %}
{% endstepper %}

### Advanced connection setup

Use a separate setup path for these cases:

* [Set up a custom Outlook OAuth connector](/workflow-builder/apps/outlook/set-up-a-custom-outlook-oauth-connector.md) — required for single-tenant and on-premises deployments. Use it when you need to restrict OAuth scopes.
* [Set up an Outlook app registration](/workflow-builder/apps/outlook/set-up-an-outlook-app-registration.md) — use app-only access for shared mailboxes and unattended workflows.

## Available Actions

### 1. Send Email

#### Description

Send an email, reply to an existing message, or forward a message using your Outlook account. Supports drafts, attachments, and recipient filtering.

#### Inputs

**recipient** (Optional)

* **Type:** String (comma-separated email addresses)
* **Description:** Recipient email address(es). If replying (`message_id` provided), leave blank to reply to original sender. If forwarding, specify new recipient(s).
* **Examples:**
  * `"recipient": "team@example.com"`
  * `"recipient": "user1@example.com, user2@example.com"`

**subject** (Optional)

* **Type:** String
* **Description:** Subject line. If replying (`message_id` provided), leave blank to use original subject.
* **Example:** `"subject": "Weekly Report"`

**body** (Required)

* **Type:** String
* **Description:** Email content. Supports plain text or HTML.
* **Example:** `"body": "Please find the attached weekly report."`

**attachment\_urls** (Optional)

* **Type:** String (comma-separated URLs)
* **Description:** File URLs to attach. Files are downloaded and attached.
* **Example:** `"attachment_urls": "https://example.com/file1.pdf, https://example.com/file2.xlsx"`

**message\_id** (Optional)

* **Type:** String
* **Description:** Microsoft Graph message ID to reply to or forward. When provided:
  * Without `recipient`: Creates a reply to original sender
  * With `recipient`: Forwards the message to new recipients
* **Example:** `"message_id": "AQMkAGY1MTc5Y2Y5LTNlMWMtNGU4NS05NzljLTRmM2IwOGNlYjI3MgBGAAAD..."`

**draft** (Optional)

* **Type:** Boolean
* **Description:** If `true`, saves the email as a draft instead of sending immediately.
* **Default:** `false`
* **Example:** `"draft": true`

**allowed\_emails** (Optional)

* **Type:** String (comma-separated email addresses)
* **Description:** Whitelist of allowed recipient addresses. If specified, emails only send to addresses in this list. Leave blank to allow all recipients.
* **Example:** `"allowed_emails": "approved1@example.com, approved2@example.com"`

#### Outputs

**result\_msg** (Always returned)

* **Type:** String
* **Description:** Summary of the email operation, including recipients, subject, body, and any errors or warnings.
* **Example:**

  ```json
  {
    "result_msg": "Recipient: team@example.com\nSubject: Weekly Report\nBody: Please find the attached report."
  }
  ```

#### Notes

* **New Emails:** `recipient` and `subject` required when not replying/forwarding
* **Replies:** When `message_id` provided without `recipient`, action replies to original sender
* **Forwards:** When `message_id` provided with `recipient`, action forwards to new recipients
* **Attachments:** Files are downloaded from provided URLs and attached
* **Drafts:** When `draft=true`, message is saved but not sent
* **Allowed Emails:** Restricts recipients to whitelist; blocked recipients reported in result message

### 2. Search Emails

#### Description

Search your Outlook mailbox for emails matching specific criteria.

#### Inputs

* **query** (Required): The search query string (e.g., keywords, sender, date).
  * Example: `"query": "from:boss@example.com subject:invoice"`
* **folder** (Optional): Specify the folder to search in (e.g., Inbox, Sent).
  * Example: `"folder": "Inbox"`
* **max\_results** (Optional): Limit the number of results.
  * Example: `"max_results": 10`

**Configurations:**

* **connection\_id** (Required if you have multiple Outlook accounts): Specify which Outlook connection to use.

#### Outputs

* **emails** (Always returned): List of matching emails with details such as subject, sender, date, and body.
  * Example:

    ```json
    {
      "emails": [
        {
          "subject": "Invoice Due",
          "from": "boss@example.com",
          "date": "2025-07-01",
          "body": "Please see the attached invoice."
        }
      ]
    }
    ```

## Best Practices

* Always ensure required fields are filled to avoid errors.
* For attachments, connect a Files node or other relevant node to provide file paths.

Automate your Outlook email workflows in StackAI to save time, reduce manual effort, and ensure consistent communication.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.stackai.com/workflow-builder/apps/outlook.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
