# Sending an email to a microsoft exchange server

**URL:** <https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342>\
**Category:** General\
**Created:** [17 December 2021 13:26 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342 "2021-12-17T13:26:26Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigunwhistle](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@bigunwhistle](https://discourse.nodered.org/u/bigunwhistle)\
**Post date:** [17 December 2021 13:26 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/1 "2021-12-17T13:26:26Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 December 2021 13:44 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/2 "2021-12-17T13:44:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bigunwhistle](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@bigunwhistle](https://discourse.nodered.org/u/bigunwhistle)\
**Post date:** [17 December 2021 16:11 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/3 "2021-12-17T16:11:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bigunwhistle](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@bigunwhistle](https://discourse.nodered.org/u/bigunwhistle)\
**Post date:** [17 December 2021 16:22 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/4 "2021-12-17T16:22:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 December 2021 16:49 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/5 "2021-12-17T16:49:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [18 December 2021 16:47 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/6 "2021-12-18T16:47:37Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/b/eb57bfd4e1146a6bd64a719961aa93ef32b74180.png)

this setting works for me.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 December 2021 18:33 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/7 "2021-12-18T18:33:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bigunwhistle](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@bigunwhistle](https://discourse.nodered.org/u/bigunwhistle)\
**Post date:** [21 December 2021 14:50 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/8 "2021-12-21T14:50:04Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [21 December 2021 15:02 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/9 "2021-12-21T15:02:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bigunwhistle](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@bigunwhistle](https://discourse.nodered.org/u/bigunwhistle)\
**Post date:** [21 December 2021 15:09 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/10 "2021-12-21T15:09:09Z")

</div>

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 = "_[username@mydomain.com](mailto:username@mydomain.com)_"  
That stopped the 'external' email alert. I need to see if there is more I can do with this....

THANK YOU ALL FOR YOUR HELP!!!!!!!

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [21 December 2021 15:42 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/11 "2021-12-21T15:42:11Z")

</div>

> [@bigunwhistle](#):
>
> So we have always been able to inject emails from other apps in there and they don't need a username or password

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 February 2022 15:42 UTC](https://discourse.nodered.org/t/sending-an-email-to-a-microsoft-exchange-server/55342/12 "2022-02-19T15:42:50Z")

</div>

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