Sending an email to a microsoft exchange server

I'm playing around with trying to get node-red to send me an email through my exchange server. I do this all the time with other applications. Ive tried the mail node on here but it isn't letting me inject the email. I get error connection refused errors. I just want to see if I can do it on node-red. my overall goal is everyday to poll open weather and get the temp then send myself an email with it.

has anyone done this?

Not sure what authentication methods the node supports. It is likely though that you are using a newer version of Exchange that disallows basic auth?

Can you send from PowerShell?

Never tried to send from powershell....
let me try that

Yeah I just sent one from powershell fine.... this is weird.

Not really. As I said, almost certainly down to what authentication types the node supports. At least we now know that you do have the rights to do a send, that is no longer a given in many organisations.

I assume you used mailsend rather than Outlook when sending from PowerShell.

What platform are you running Node-RED on? Windows or Linux?

A workaround would be to use the exec node and a PowerShell script.


this setting works for me.

Thanks for sharing. But that is for cloud-based Exchange Online - and only works if you don't have MFA turned on unless you then register and use an application password. The OP was about an on-prem server I believe.

1 Like

Yeah it's on-prem... So far I can send emails now via kicking off powershell and sending it that way. I have been playing around more with the settings of node-red-node-email and I'm not getting authentication errors so at least its now hitting the server. I'm thinking it's looking for a 'from' maybe?

It should take the default from from the id you use for authentication. You may need to check the Exchange server logs to see what is happening.

It's weird I'm looking at the logs but nothing was there... So we have always been able to inject emails from other apps in there and they don't need a username or password. so this is what I did, I removed username and password and it started getting 'external' emails, I'm not sure why this didn't work last week when i tried it but who knows. After that I edited, 61-email.js and after line 98 I added:
sendopt.from = ""
That stopped the 'external' email alert. I need to see if there is more I can do with this....


So, that isn't a configuration I would allow in our organisation. Emails should always be tracable and it generally isn't a good idea to allow any old application to send them without authentication so we would require at least a service account to be defined for each application that sends emails. Probably with a non-expiring password.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.