n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
47.67k stars 7.25k forks source link

Microsoft Outlook Send Message Bad API Use #11113

Closed advenimus closed 3 weeks ago

advenimus commented 3 weeks ago

Bug Description

Appears that something is wrong with the use of the API in the node for send message.

When using this node, emails are sent, hit M365 exchange and appear in sent folder (if selected to do so) but always return with an NDR stating: Error: ‎550 5.7.708 Service unavailable. Access denied, traffic not accepted from this IP. For more information please go to http://go.microsoft.com/fwlink/?LinkId=526653 AS(7910)‎

The NDR also shows: Your message wasn't delivered because the recipient's email provider rejected it.

After extensive testing and work with Microsoft, I can confirm it is something very specific to this node. Here's how I have come to that conclusion:

ScreenShot 2024-10-04 at 11 55 38@2x ScreenShot 2024-10-04 at 11 56 31@2x

To Reproduce

  1. Import my workflow and test both methods and test against M365 with a shared mailbox or user mailbox. Test_Outlook_Send.json

Expected behavior

Expected email to be received, but not.

Operating System

Ubuntu 24.04.1 LTS

n8n Version

1.61.0

Node.js Version

20.17.0

Database

SQLite (default)

Execution mode

main (default)

Joffcom commented 3 weeks ago

Hey @advenimus,

We have created an internal ticket to look into this which we will be tracking as "GHC-285"

Joffcom commented 3 weeks ago

Hey @advenimus

That is very unusual, the error message from Microsoft looks very clear it is saying traffic is blocked from your n8n servers IP.

What I don't get though is why power shell works unless you are not sending the message using the same ip or for some reason poweshell is sending from a different public IP.

I have tried sending an email using the Outlook node from my n8n instance and it has worked as expected so I don't currently think this is a node issue.

Can you share the powershell commands you ran on your Ubuntu server so I can check them against what we do in the node?

advenimus commented 3 weeks ago

I figured it out! Hours and hours with support from MS, no one could get it. This node has a requirement that DKIM is setup, unfortunately that is not recorded in node docs. Perhaps that could be added?

Joffcom commented 3 weeks ago

Hey @advenimus

Can you clarify on that? The node just uses the Microsoft API so wouldn't be doing any DKIM checks.

advenimus commented 3 weeks ago

Apologies, let me expand.

So if your using a domain where you manage your own DNS with M365, then DKIM must be setup for use with Outlook REST API and Graph API, which is the underlying technology this node uses. It's not a requirement to add to docs I should say, but may be useful to throw in there in case anyone else has this issue.

Joffcom commented 2 weeks ago

Hey @advenimus

Thanks for expanding, I will pass this to the docs team to consider. Maybe we can add it to a troubleshooting section, do you happen to have a link to the MS documentation that mentions this as I couldn't see anything