ExchangeNerd

Powered by Ed Buford and Coffee

Configuring an Onsite Relay for Office 365

Moving to the cloud comes with a lot of things no one ever thinks about.  One of those things is SMTP traffic from Printers, Network Monitors and Line of Business apps that have been sending mail straight to an Exchange server for the past decade (or longer). SO what do you do with that SMTP traffic to get it up to Office 365?

Well, the best and most reliable way to do this by setting up an IIS SMTP Relay. To do this from the Windows world your choice is to use an IIS 6 SMTP configuration.  A good server to do this from would be your DirSync Server.
Here’s what you need to know to do it:

First in Office 365 you’ll need to configure a connection to your On-Premise connection.  So log into your Office 365 Admin Portal and choose Exchange. From the list on the left choose Mail Flow and then choose Connectors from the options and create a new Inbound Connector:
Be certain to add the IP that your server purports to be an easy way to see that is http://www.whatismyip.com 

Make the connector an On-Premises connector and then add your Domain and make certain you set it to Opportunistic TLS.

O365Connector

Once you’ve created the connector you’ll need to setup IIS 6.

In Server Manager Add a new Feature. In the list check the box for SMTP. It will pop up a box with everything you need for SMTP.

SMTP_!!S

Once this installs go to the Administrative tools and Launch IIS 6.0 Manager.

IIS6

If you click on Domains you’ll see the domain will become the FQDN of the server itself. I recommend that you right click on this and change to an HostName.Domain.Onmicrosoft.com for good measures.  Now add a new REMOTE Domain by right clicking Domains and selecting New.  Now choose your new domain from the list and right click for Properties.

Check the box to allow Incoming mail to be relayed

And then click OK

RelayDomain

Now right click the SMTP Server name and choose properties from the list.  Click the Connection button and from there select the Radio button for Only the list below and add IP addresses for each device you want to relay email for.

Access

The Default IIS Outbound connection is Port 25 so you don’t have to do anything there.
It is best practice to use TLS as a connection so under the Delivery Tab choose Outbound Security make sure Anonymous Access and TLS are both selected

Outbound

After you make any changes to an SMTP Virtual server you need to stop and restart it.
Do this by right clicking the SMTP Virtual Server in the Navigation pane and choosing stop.
Once it’s stopped right click and start it.

Now test it you should be able to see mail going into and out of the Mailroot Queue:

MailRoot

Leave a Reply

Your email address will not be published. Required fields are marked *