> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jinba.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Outlook Mail

> Email operations using Outlook via Microsoft Graph

## Overview

The Outlook Mail tools allow you to list messages from Outlook mail folders and send emails through Outlook using the Microsoft Graph API.

## Key Features

* `OUTLOOK_LIST_MESSAGES`
  * List messages from an Outlook mail folder
  * Optional `folder` input (e.g., `Inbox`); if omitted, lists messages across all folders
  * Optional `search` query using Microsoft Graph `$search` (matches subject, body, and sender)
  * `top` controls the number of messages to fetch (1-50, default: 10)
  * `include_body_preview` toggles whether each message includes a body preview (default: true)
  * Returns each message's id, subject, sender, received date, body preview, and web link
* `OUTLOOK_SEND_MESSAGE`
  * Send an email through Outlook
  * `to_emails` accepts an array or a comma-separated string; optional `cc_emails` and `bcc_emails`
  * `body` supports HTML or plain text, selected via `content_type` (`HTML` or `Text`, default: `HTML`)
  * `save_to_sent_items` controls whether the message is saved to Sent Items (default: true)

## Authentication

To use the Outlook Mail tools, you need to navigate to the [Jinba secrets dashboard](https://flow.jinba.io/workspace/secrets) and authenticate with your Microsoft account. This will create a new OAuth token for you.

**Note**: Treat API keys as sensitive information and never commit them to public repositories.

For further details, [click here](/en/pages/credentials/microsoft-oauth).

## Usage Examples

### Example: Search the Inbox and Send a Summary

```yaml theme={null}
- id: list_messages
  tool: OUTLOOK_LIST_MESSAGES
  config:
    - name: token
      value: "{{secrets.MICROSOFT_GRAPH_OUTLOOK}}"
  input:
    - name: folder
      value: Inbox
    - name: search
      value: invoice
    - name: top
      value: 20
    - name: include_body_preview
      value: true

- id: summarize
  tool: OPENAI_INVOKE
  needs:
    - list_messages
  config:
    - name: version
      value: gpt-4
  input:
    - name: prompt
      value: |
        Summarize the following emails into a short report.

        {{steps.list_messages.result.messages}}

- id: send_report
  tool: OUTLOOK_SEND_MESSAGE
  needs:
    - summarize
  config:
    - name: token
      value: "{{secrets.MICROSOFT_GRAPH_OUTLOOK}}"
  input:
    - name: to_emails
      value: manager@example.com
    - name: cc_emails
      value: team@example.com, accounting@example.com
    - name: subject
      value: Daily invoice email summary
    - name: body
      value: "{{steps.summarize.result.content}}"
    - name: content_type
      value: Text
```

### Example: Send an HTML Email

```yaml theme={null}
- id: send_message
  tool: OUTLOOK_SEND_MESSAGE
  config:
    - name: token
      value: "{{secrets.MICROSOFT_GRAPH_OUTLOOK}}"
  input:
    - name: to_emails
      value: customer@example.com
    - name: subject
      value: Your order has shipped
    - name: body
      value: "<p>Hello,</p><p>Your order has shipped and is on its way.</p>"
    - name: content_type
      value: HTML
    - name: save_to_sent_items
      value: true
```

## Notes

* `OUTLOOK_LIST_MESSAGES` can fetch at most 50 messages per run (`top` accepts 1-50).
* `OUTLOOK_SEND_MESSAGE` returns the HTTP status of the Microsoft Graph `sendMail` request (202 on success); the response normally has no body.
* Recipient inputs (`to_emails`, `cc_emails`, `bcc_emails`) accept an array, a JSON array string, or a comma-separated string.
* Set `include_body_preview` to `false` when you only need message metadata and want to keep outputs compact.
