Describe the problem/error/question
Hey all I’m trying to setup n8n system mail to O365. I’m attempting to use oauth2 and an app registration to configure this for Modern Auth but I cannot get it to function. I am able to use the OAUTH config in a workflow to send mail so I know my O365 config is working.
What is the error message (if any)?
When I attempt to set the flags below in the docker compose.yml file and I’ve also tried to insert them directly into the config.json file
I’ve also tried as many combinations as possible of ports/security flags/anything I can think of that might help like port 25, ssl false/true, different o365 connection points for smtp that I found in the online docs, and so on with no luck
I have tested the connection in the docker container with telnet and it works fine
When I attempt to invite a user, I keep getting these errors:
Could not invite 28F2B5B3AA780000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=correct scrubbed value
- N8N_BASIC_AUTH_PASSWORD=correct scrubbed value
- N8N_HOST=correct scrubbed value
- WEBHOOK_URL=https://correct scrubbed value/
- N8N_PROTOCOL=https
- N8N_PORT=5678
- NODE_ENV=production
# Trust reverse proxy
- N8N_EXPRESS_TRUST_PROXY=true
# Email config
- N8N_EMAIL_MODE=smtp
- N8N_SMTP_HOST=smtp.office365.com
- N8N_SMTP_PORT=587
- N8N_SMTP_SECURE=false
- N8N_SMTP_USER=correct scrubbed value
- N8N_SMTP_SENDER=correct scrubbed value
# OAuth2 details
- N8N_SMTP_OAUTH2_TYPE=custom
- N8N_SMTP_OAUTH2_CLIENT_ID=correct scrubbed value
- N8N_SMTP_OAUTH2_CLIENT_SECRET=correct scrubbed value
- N8N_SMTP_OAUTH2_TOKEN_URL=https://login.microsoftonline.com/correct scrubbed value/oauth2/v2.0/token
- N8N_SMTP_OAUTH2_REFRESH_TOKEN=<insert your full refresh token>
- N8N_SMTP_OAUTH2_USER=correct scrubbed value
Please share your workflow
No workflow as this is system mail
Share the output returned by the last node
no last node as this is system mail
Information on your n8n setup
- n8n version:
- --version 1.108.2
- Database (default: SQLite):
- SQLite
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Own
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Docker
- Operating system:
- azure #36~22.04.1-Ubuntu SMP Tue Jul 1 03:54:01 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
- PRETTY_NAME=“Ubuntu 22.04.5 LTS”
NAME=“Ubuntu”
VERSION_ID=“22.04”
VERSION=“22.04.5 LTS (Jammy Jellyfish)”