Link to home
Start Free TrialLog in
Avatar of madmin
madmin

asked on

Windows Server 2012 IIS SMTP relay to O365 - works when sending from Powershell, but not network devices

Hello Experts,
I am trying to get my server set up to act as an SMTP relay to smtp.o365.com. It works when I use Powershell from my machine using this command:

Send-MailMessage -From smtp@mydomain.com -To me@mydomain.com -Subject "Test"
 -Body "Test" -SmtpServer myserver.mydomain.com -Port 25

Open in new window


Note that my IIS server is set up to accept on port 25, but it transmits to smpt.o365.com on 587. Again, the command above works, so the authentication set up on IIS must be working!

What's interesting are the smtp logs. Here is my PC via Powershell:

22:04:56 192.168.2.106 EHLO - 250
22:04:56 192.168.2.106 MAIL - 250
22:04:56 192.168.2.106 RCPT - 250
22:04:56 192.168.2.106 DATA - 250
22:04:56 40.97.169.242 - - 0
22:04:56 40.97.169.242 EHLO - 0
22:04:56 40.97.169.242 - - 0
22:04:56 40.97.169.242 STARTTLS - 0
22:04:56 40.97.169.242 - - 0
22:04:56 40.97.169.242 EHLO - 0
22:04:56 40.97.169.242 - - 0
22:04:56 40.97.169.242 AUTH - 0
22:04:56 40.97.169.242 - - 0
22:04:58 40.97.169.242 - - 0
22:04:58 40.97.169.242 MAIL - 0
22:04:58 40.97.169.242 - - 0
22:04:58 40.97.169.242 RCPT - 0
22:04:58 40.97.169.242 - - 0
22:04:58 40.97.169.242 BDAT - 0
22:04:58 40.97.169.242 - - 0
22:04:58 40.97.169.242 QUIT - 0
22:04:58 40.97.169.242 - - 0
22:06:07 192.168.2.106 QUIT - 240

Open in new window


Here is a network device (in this case it's an MFP, but a network security device looks the same):

22:04:37 192.168.2.25 EHLO - 250
22:04:37 192.168.2.25 MAIL - 250
22:04:37 192.168.2.25 RCPT - 250
22:04:37 192.168.2.25 DATA - 250
22:04:37 192.168.2.25 QUIT - 240
22:04:37 40.97.147.18 - - 0
22:04:37 40.97.147.18 EHLO - 0
22:04:37 40.97.147.18 - - 0
22:04:37 40.97.147.18 STARTTLS - 0
22:04:37 40.97.147.18 - - 0
22:04:37 40.97.147.18 EHLO - 0
22:04:38 40.97.147.18 - - 0
22:04:38 40.97.147.18 AUTH - 0
22:04:38 40.97.147.18 - - 0
22:04:40 40.97.147.18 - - 0
22:04:40 40.97.147.18 MAIL - 0
22:04:40 40.97.147.18 - - 0
22:04:40 40.97.147.18 RCPT - 0
22:04:40 40.97.147.18 - - 0
22:04:40 40.97.147.18 BDAT - 0
22:04:46 40.97.147.18 - - 0
22:04:46 40.97.147.18 QUIT - 0
22:04:46 40.97.147.18 - - 0
22:04:46 40.97.147.18 - - 0
22:04:46 40.97.147.18 EHLO - 0
22:04:46 40.97.147.18 - - 0
22:04:46 40.97.147.18 STARTTLS - 0
22:04:46 40.97.147.18 - - 0
22:04:46 40.97.147.18 EHLO - 0
22:04:46 40.97.147.18 - - 0
22:04:46 40.97.147.18 AUTH - 0
22:04:46 40.97.147.18 - - 0
22:04:48 40.97.147.18 - - 0
22:04:48 40.97.147.18 MAIL - 0
22:04:48 40.97.147.18 - - 0
22:04:48 40.97.147.18 RCPT - 0
22:04:48 40.97.147.18 - - 0
22:04:48 40.97.147.18 BDAT - 0
22:04:53 40.97.147.18 - - 0
22:04:53 40.97.147.18 QUIT - 0
22:04:53 40.97.147.18 - - 0

Open in new window


On the network device, it looks like it attempts to send to O365 twice. But what is noteworthy I believe is that the final line on the log for my PC is a QUIT by my PC, whereas on the network device, the device is quitting before the relay to O365. There are no options in the network device SMTP settings that suggest configuring this behavior.

Any thoughts would be greatly appreciated.
Avatar of madmin
madmin

ASKER

I should also add that I am sending anonymously from the client to my IIS server from both Powershell and the network devices.
Avatar of Ravi Kumar Atrey
I don't see that poweshell is also working. O365 don't allow to relay mails without SMTP authentication. You must use SMTP authentication and check then.
Avatar of madmin

ASKER

My IIS server accepts anon connections from clients. My IIS server connects to smtp.office365.com over port 587 using auth.

I know the Powershell worked because I got the email. :-)
So what network device you are using and not getting SMTP relay settings?
Avatar of madmin

ASKER

An MFP and a security device. Interestingly my MFP says that the test email was successfully sent, but I receive no email (I checked all spam filters).
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.