Outlook

Learn how to automate Outlook email tasks in StackAI. Discover available actions, required inputs, configurations, and output examples for seamless workflow integration.

To use the Outlook Node in StackAI, simply add it to your workflow and configure the desired action. Connect it to other nodes to dynamically generate email content, recipients, or attachments. You can use this node to send emails, search your mailbox, or automate other Outlook-related tasks.

Connecting to Outlook

There are two types of connections you can set up for Outlook:

OAuth2 Connection

To set up an OAuth2 connection, log in to your Microsoft account through StackAI. Your connection will inherit your permissions and access.

App Registration Connection

Follow the set up instructions here to create an app registration in Microsoft.

If using an App Registration connection (not OAuth), your Azure AD application requires these Application permissions:

  • Mail.Send - Send emails as any user

  • Mail.Read - Read you emails (for the Search Emails Action)

  • Mail.ReadWrite - Create drafts, add attachments, modify messages, reply/forward

  • MailboxSettings.Read - Get list of email categories (for Set Email Category Action)

  • Calendars.ReadWrite - Read your calendar and create calendar events (for Create Event Action)

  • User.Read.All - Read users profiles (Optional)

Important: After adding these permissions in Azure Portal, click "Grant admin consent" for your tenant.


Available Actions

Below are the most commonly used Outlook actions in StackAI:

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 to a message (message_id provided), leave blank to reply to the original sender. If forwarding, specify new recipient(s).

  • Examples:

subject (Optional)

  • Type: String

  • Description: Subject line of the email. If replying to a message (message_id provided), leave blank to use the original subject.

  • Example: "subject": "Weekly Report"

body (Required)

  • Type: String

  • Description: Content/body of the email. Supports plain text or HTML.

  • Example: "body": "Please find the attached weekly report."

attachment_urls (Optional)

  • Type: String (comma-separated URLs)

  • Description: URLs of files to attach to the email. Files will be 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 the original sender

    • With recipient: Forwards the message to new recipient(s)

  • Example: "message_id": "AQMkAGY1MTc5Y2Y5LTNlMWMtNGU4NS05NzljLTRmM2IwOGNlYjI3MgBGAAAD..."

draft (Optional)

  • Type: Boolean

  • Description: If true, saves the email as a draft instead of sending it immediately.

  • Default: false

  • Example: "draft": true

allowed_emails (Optional)

  • Type: String (comma-separated email addresses)

  • Description: Whitelist of allowed recipient email addresses. If specified, emails will only be sent to addresses in this list. Leave blank to allow all recipients.

  • Example: "allowed_emails": "[email protected], [email protected]"

Outputs

result_msg (Always returned)

  • Type: String

  • Description: Summary of the email operation, including recipients, subject, body, and any errors or warnings.

  • Example:


Notes

  • New Emails: recipient and subject are required when not replying/forwarding

  • Replies: When message_id is provided without recipient, the action replies to the original sender

  • Forwards: When message_id is provided with recipient, the action forwards to new recipients

  • Attachments: Files are downloaded from provided URLs and attached to the message

  • Drafts: When draft=true, the message is saved but not sent

  • Allowed Emails: Use to restrict recipients to a whitelist; blocked recipients are reported in the 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).

  • 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 the Outlook connection to use.

Outputs:

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

    • Example:


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.

Last updated

Was this helpful?