Windows 2019 and IIS Virtual SMTP Virtual Relay (Office 365)

pe flag

I have hit a wall with this setup and I cant for the life of me figure this out, despite having setup a few other Virtual SMTP servers in the past. Maybe something has changed in 2019?

I will provide as much info as possible to help you help me :)

I have installed SMTP Server and Telnet Client on my 2019 server, I have followed guides and rechecked my settings to ensure all is setup correctly.


  • I have all unassigned IP addresses allowed


  • Authentication set to 'Anonymous'
  • TLS Greyed out
  • Connection control and relay restrictions set to allow all with a blank list below.


  • All left as default


Outbound Security

  • Basic Authentication with the Office 365 username and password set.

Outbound connection

  • TCP Port: 587

Advanced Delivery

  • Smart host is set to:

[LDAP] and [Security] tabs are default.

The Office 365 user is set to SMTP auth enabled and I have confirmed this via PowerShell.

telnet 25 shows:

220 Microsoft ESMTP MAIL Service, Version: 10.0.17763.1697 ready at Tue, 7 Sep 2021 13:53:35 +1000

However, when trying to send an email via this relay it stays in the C:\inetpub\mailroot\Queue directory and I get the below in the event log:

Message delivery to the host 'X.X.X.X' failed while delivering to the remote domain '' for the following reason: The remote SMTP service rejected AUTH negotiation.

I will probably kick myself once I figure this out, but I must be going mad.

EDIT: forgot to add...

I can also telnet from the network to on port 587 and have also configured a connector in Office 365 for WAN IPs which are in use on my network.

Thanks! Bil

pe flag

OK, so after a few more hours of troubleshooting. I saw some failed sign in requests in the admin center, which lead me down the conditional access path.

I had some previously setup location blocking in Office 365, so disabled that as a precaution but I think what ended up doing it was disabling security defaults in azure.


djdomi avatar
za flag
in case its solved, please accept your own answer

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.