Connect n8n to Outlook: Complete Setup Guide
Step-by-step guide to authenticate n8n with Outlook via Azure OAuth2, configure permissions, build email workflows, and fix common self-hosted errors.
- Register an Azure app, get Client ID and Secret, then configure Microsoft Graph permissions (Mail.Read, Mail.ReadWrite, Mail.Send)
- Paste those credentials into n8n's Outlook OAuth2 credential dialog, authenticate, and start building workflows
- Use Outlook triggers to watch for new emails, actions to send/reply, and handle shared mailboxes by delegating access in Azure AD
- Self-hosted instances need correct N8N_HOST, N8N_PROTOCOL, and N8N_TRUST_PROXY settings or OAuth Redirect URIs will mismatch and fail
To connect n8n to Outlook, you register an Azure app, configure Microsoft Graph permissions, then authenticate using OAuth2 in n8n. This guide walks you through the exact steps, including the common pitfalls on self-hosted instances.
Outlook integration in n8n lets you automate email workflows: trigger actions when new messages arrive, send replies, forward emails, manage attachments, even handle shared mailboxes. You need an Azure account and a few specific permissions, but the setup takes about 15 minutes.
What You'll Need: Prerequisites & Permissions
Before you start, gather these requirements. You need an Azure account (free tier works), admin access to your Microsoft 365 tenant (or a way to request admin consent), an n8n instance (self-hosted or cloud), and a Outlook mailbox to test with. For shared mailboxes, you'll need additional permissions configured by your admin.
n8n's Outlook node requires OAuth2 authentication via Microsoft Entra (formerly Azure AD). Unlike IMAP/SMTP, OAuth2 is stateless: tokens refresh automatically, permissions are granular, and you avoid storing passwords in plain text. The trade-off is that setup requires touching Azure portal.
If you're running n8n self-hosted, note that your instance must be accessible over the public internet during the OAuth handshake. The redirect URI (the URL n8n uses to receive the OAuth callback) must match exactly what you register in Azure. We'll cover that gotcha later.
Step 1: Register Your Azure App & Configure Permissions
Register an app in Microsoft Entra to get the credentials n8n needs. Navigate to Azure portal, go to Microsoft Entra ID, select "App registrations", then "New registration". Give it a name like "n8n Outlook Integration". Leave redirect URI blank for now; you'll add it after creating the app.
Once registered, copy the Application (Client) ID and Tenant ID: you'll paste these into n8n later. Next, create a client secret: go to "Certificates & secrets", click "New client secret", set it to expire in 24 months or longer, and copy the secret value immediately (you can't retrieve it later). Store this secret somewhere safe, like a password manager.
Now configure the permissions. In the app details, click "API permissions", then "Add a permission". Select "Microsoft Graph", then "Delegated permissions". Search for and add these scopes:
- Mail.Read (read messages)
- Mail.ReadWrite (read and modify messages)
- Mail.Send (send messages)
- Calendars.ReadWrite (calendar access, if needed)
- Contacts.ReadWrite (contact access, if needed)
After adding permissions, you'll see an "Admin consent required" message. If you're a tenant admin, click "Grant admin consent for [Organization]". If not, your admin must do this. Without it, users will hit a "Need admin approval" error during OAuth sign-in.
Add the redirect URI once you know your n8n URL. Go back to "Authentication", click "Add a platform", select "Web", and enter your redirect URI. For cloud n8n, use https://app.n8n.cloud/oauth2/callback. For self-hosted, construct your redirect URI by appending /oauth2/callback to your n8n's public domain. Self-hosted users: this URL must be FQDN-only (not an IP), must be over HTTPS, and must be accessible from the public internet.
Step 2: Connect Outlook to n8n
In n8n, create a new workflow. Add any trigger node first (or start with a manual trigger). Now add an n8n Outlook node: click "+", search "Outlook", and select "Microsoft Outlook" (not "Microsoft Outlook Admin"). Click "Create new credential".
In the credential dialog, select "OAuth2" as the authentication type. Paste your Client ID and Client Secret from Azure. For the OAuth2 endpoints, use Microsoft's standard endpoints: Authorization URL is https://login.microsoftonline.com/<TENANT_ID>/oauth2/v2.0/authorize, Token URL is https://login.microsoftonline.com/<TENANT_ID>/oauth2/v2.0/token. Replace <TENANT_ID> with your actual Tenant ID.
Set the scope to: Mail.Read Mail.ReadWrite Mail.Send Calendars.ReadWrite Contacts.ReadWrite offline_access. The offline_access scope allows token refresh without user interaction.
Click "Connect my account". You'll be redirected to sign in with your Outlook/Microsoft account. If you're not a tenant admin, you may see a consent screen asking "Admin approval required". Your admin must grant consent in Azure before you can proceed. If the sign-in succeeds, you'll see "Connected" and the credential is saved.
Working with Outlook Nodes: Triggers and Actions
Once connected, the Outlook node gives you two modes: trigger and action. The trigger watches for new emails and fires your workflow. The action sends, replies to, moves, or modifies emails. Each mode supports specific operations.
Trigger mode: Select "On new message received". The node will poll Outlook for new emails in your inbox every 30 seconds (configurable). You can filter by sender, subject, or folder. Important: triggers only work during n8n execution. If your workflow is paused or n8n is offline, emails won't fire the trigger. For mission-critical automated replies, consider running n8n 24/7 or using a webhook-based approach.
Action modes include Send (compose and send a new email), Reply (respond to a specific message), Move (move message to a folder), Update (mark read/unread, flag), Get Many (retrieve multiple messages with filters), and Create Draft (save unsent email). Each action accepts expressions, so you can dynamically build email bodies from upstream nodes.
For shared mailboxes: add the shared mailbox address to your Outlook profile first (via Outlook settings). Then, in the trigger or action, you can select which mailbox folder to watch or send from.
Practical Example: Email Triage Workflow
Let's build a simple email-triage workflow. The goal: when a new email arrives in a "support" shared mailbox, extract the sender and subject, then send an auto-acknowledgment reply.
Start with an Outlook trigger: "On new message received" from the support mailbox. Add an Outlook action node: select "Reply". Set the message ID to {{ $json.id }} (the trigger's email ID). Set the reply body to:
Thanks for reaching out, {{ $json.from.name }}. We've received your message about "{{ $json.subject }}" and will get back to you within 24 hours.
That's it. Each time a new email lands, the workflow fires, extracts the sender and subject, and sends a reply. No manual intervention needed.
To add filtering: in the trigger, set "Folder" to "support" and add a "Filter" condition, e.g., subject contains "urgent". Now only emails marked urgent trigger the workflow. You can expand this to send different replies based on content (add an "If" node to check the subject or body, then branch to different reply nodes).
For shared mailboxes, delegated access depends on Azure AD group membership. Your admin grants the shared mailbox to users or security groups; those users can then connect via n8n.
Troubleshooting Common Errors
The most common error is "401 Authorization failed". This usually means:
- Your token expired and can't refresh. Solution: re-authenticate the credential.
- The user who authenticated no longer has permission to access the mailbox. Solution: grant the user access via Outlook admin, then re-authenticate.
- On self-hosted: the OAuth Redirect URI doesn't match Azure. The registered redirect URI (for example, your public n8n domain with
/oauth2/callbackappended) must match exactly what n8n is trying to send. Solution: ensure your n8n URL in Azure matches your public-facing domain, including protocol and trailing slash.
"Need admin approval" error: the OAuth permission scopes weren't granted consent in Azure. Your tenant admin must go to the app registration in Azure portal, click "API permissions", and click "Grant admin consent for [Organization]". Once done, re-authenticate in n8n.
"Redirect URI mismatch": your OAuth callback URL registered in Azure must match the URL n8n is trying to use when redirecting after sign-in. Solution: verify that the redirect URI you configured matches your actual n8n public URL, or add multiple redirect URIs in Azure if you need both cloud and local testing (you can register multiple).
Token refresh failures on self-hosted: if your n8n restarts during token refresh, the token may become invalid. Keep your instance running and set N8N_SECURE_COOKIE=true in your environment to prevent cookie-related auth issues.
Self-Hosted Configuration & Gotchas
Self-hosted n8n has extra OAuth complexity because your instance may sit behind a reverse proxy (Nginx, Traefik, Caddy). The OAuth redirect URI must be the public-facing URL of n8n, not the internal Docker container IP.
Set N8N_HOST to your public domain. Set N8N_PORT to 443 (HTTPS only for OAuth). Set N8N_PROTOCOL=https. These ensure n8n generates the correct OAuth callback URLs.
If you're behind a reverse proxy like Traefik, ensure X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Port headers are passed through. In n8n, set N8N_TRUST_PROXY=true. Without this, n8n sees the internal proxy IP, not the public domain, and OAuth fails.
For Azure OAuth specifically on self-hosted: use the tenant-specific endpoint, not the common endpoint. Azure's "common" endpoint (/common/oauth2/v2.0/token) may not work reliably for refresh tokens on self-hosted. Instead, use https://login.microsoftonline.com/<TENANT_ID>/oauth2/v2.0/token with your explicit Tenant ID.
If you get "SSL certificate verify failed" errors, your self-hosted instance can't reach Azure to refresh tokens. This may happen if you're behind a corporate proxy. Set the HTTPS_PROXY environment variable in your deployment configuration. Restart n8n.
Frequently Asked Questions
How do I set up Microsoft Outlook OAuth2 in n8n? Register an app in Microsoft Entra, copy the Client ID and Secret, add Microsoft Graph permissions (Mail.Read, Mail.ReadWrite, Mail.Send), configure the redirect URI, then paste those credentials into n8n's Outlook credential dialog and authenticate.
What are the required Azure permissions for n8n Outlook integration? You need Mail.Read for reading emails, Mail.ReadWrite for modifying them, Mail.Send for sending, Calendars.ReadWrite if you're accessing calendars, and offline_access for token refresh. Your tenant admin must grant consent in Azure portal.
Can I use n8n to automate Outlook email replies? Yes. Use the Outlook trigger "On new message received" to watch for emails, then add an Outlook action node set to "Reply". You can customize the reply body with expressions, so replies can reference the original sender, subject, or body text.
Why do I get a 401 error when connecting Outlook to self-hosted n8n? The most common cause is an OAuth Redirect URI mismatch. Your n8n URL in Azure must match exactly what n8n is trying to send. Check that N8N_HOST, N8N_PORT, and N8N_PROTOCOL are set correctly and N8N_TRUST_PROXY=true if behind a reverse proxy.
How do I configure Outlook for a shared mailbox in n8n? Add the shared mailbox to your Outlook profile via Outlook settings. Then, in the Outlook trigger or action node, select the shared mailbox folder from the dropdown. Your tenant admin must grant you access to the shared mailbox first.
Can I trigger workflows when new emails arrive in Outlook? Yes. Use the Outlook trigger node with "On new message received". The trigger checks for new emails every 30 seconds by default. You can filter by folder, sender, or subject. Keep in mind the trigger only works while n8n is running.
What scopes do I need for Outlook Mail.Send and Mail.Read? Mail.Read allows reading messages. Mail.ReadWrite allows both reading and modifying (marking read/unread, moving to folders). Mail.Send allows sending new messages or replies. For shared mailboxes, your admin must delegate permission at the mailbox level in Azure AD.
The Bottom Line
Connecting n8n to Outlook is straightforward once you navigate Azure app registration and permission scopes. The OAuth2 flow is secure, tokens refresh automatically, and you're not storing passwords. Start with a simple trigger and reply workflow, then expand to multi-step automation like email triage or message forwarding. For self-hosted deployments, pay attention to your public-facing URL and proxy configuration to avoid OAuth redirect URI mismatches.
If you're running n8n on your own infrastructure and need production support, Opsily's managed n8n hosting handles all the proxy, TLS, and authentication setup for you, so you can focus on your workflows instead of infrastructure.