Sending emails from a Windows server with Office365?

Started by wim.cossement, May 25, 2021, 10:07:54 PM

Previous topic - Next topic

wim.cossement

Hello,

Has anyone already been able to use smtp.office365.com as their mail server from a Windows box?

Ive been playing around at home with a Debian client and Debian server and via Postfix I can relay mail alerts to Gmail but now they want me to implement the whole shebang on a Windows only environment for an internship. But sending mails from a Windows machine seems to be a PITA.
I can use a tool to test it that saves it's account settings in an XML file like SwithMail and this works file from the command line as a local user but if I define this (for testing) in the server actions nothing happens.
PowerShell could perhaps be another option but then again, the action needs to be executed so am I missing something?

Thanks,

Wim

Victor Kirhenshtein

Hi,

I suppose that smtp.office365.com will require authentication, which is not supported by built-in SMTP sender. Easiest way is to install mail forwarder on same machine, configure NetXMS server to send mails to 127.0.0.1 and then forward everything to smtp.office365.com with proper authentication and encryption There are multiple SMTP relays available for Windows. Quick search reveals post for dealing with exact same problem (sending mail to office365 from software that can only do plain SMTP): https://xo.tc/simple-windows-smtp-relay.html

Best regards,
Victor

wim.cossement

I won't be able to use that because this requires a Windows server and I'm running this on a simplevWindows 10 box.
There are other mail relays out there like hMailServer but the configuration seems a bit confusing to me and I haven't gotten it up yet but will keep trying.
Otherwise I'll try to convince them to let me use a Linux box instead for the server...  ;)

Thanks,

Wim

2b2bff

If you want a Microsoft only solution, you can use the smtp server that is built-in to IIS. There a plenty of guides out there how to set this up.

wim.cossement

Yes I know but then you need another Windows box and license.

But relaying via Postfix is also easy, once you know how to configure it...  8)

I used this one to test it with G-mail first: https://www.howtoforge.com/tutorial/configure-postfix-to-use-gmail-as-a-mail-relay
This is for OWA 365 but very similar: https://www.informaticapressapochista.com/linux/configure-postfix-use-office365-smtp-relay-ubuntu-16-04/
Microsoft is not as cool as Google when it comes to accepting mails not being sent by the authenticated use so you have to change the headers a bit; they must be the same as the account you'll log in to OWA 365 or your message gets rejected: https://wiki.4psa.com/display/KB/How+to+change+the+From+header+for+messages+sent+by+Postfix

These last 6 weeks have been interesting because I learnt a lot about this nice NetXMS product but now my project's time's up.

2b2bff

Quote from: wim.cossement on June 24, 2021, 02:44:18 PM
Yes I know but then you need another Windows box and license.

Just for the record - you can install them on the same box. No extra machine is needed...

Filipp Sudanov