Configure an SMTP relay for Office 365

                           How can we Configure an internal SMTP Relay for Office 365 ???

Now we have a question in front of us, Ho! How can we Configure an internal SMTP relay for Office 365 ???

The Answer should start from why you need to configure an SMTP relay ? Let us come to the point, now a days most of the SMB customers are moving out their email environment to office365, but still their are many applications/devices which needs to send emails to users/admins etc.

I can give you an example on these scenario that, you might have scanners\copier where you need to send the scan document to respective or a particular email ID and their might be any backup application which needs to report the Job completion or job failed/warnings to the backup administrator through Auto configured email settings.

If you have a local/on-premise Exchange you can do this by configure internal email connector and asking the Application/Device to send the emails using on-premise exchange. But coming to cloud its completely different.

Every thing over the Cloud will go in a secured way, it wont directly accept the emails\request, Here it is time to introduce a SMTP relay server in your on-premise environment and instructing the "Application\Email enabled devices(Scanners) to send emails to internal SMTP Relay server where it will pass on the received emails to Office 365 servers in a secured way.
SMTP relay for Office 365
SMTP relay for Office 365
Step 1: Configure SMTP Server
Install the SMTP and all its dependency roles and features through  Server Manager.

SMTP and all its dependency roles


Step 2: Get the Office 365 SMTP Server Settings from Outlook Web App


  • Access the Outlook Web App, go to Settings, then click Options\See All Options.
  • In the left navigation pane, click Account, click My Account and in the Account Information area, click Settings for SMTP access.



  • Note down the SMTP settings.

Step 3: Configure the On-premise SMTP Relay:

  • Open IIS 6.0 Manager,  right click and  select the properties of Default SMTP Virtual Server.
  • Click the Access tab and then click on Relay.
  • In the Select which computers may relay through this virtual server area, click Only the list below, and then enter the IP addresses of the on-premises LOB devices and application servers that will relay through the SMTP server.
  • Now go to the Access tab, click Authentication, make sure that the Anonymous access check box is selected and then click OK.
  • Now click on the Delivery tab, click Advanced, and then, under Smart host, enter the fully qualified domain name (FQDN) of the SMTP server which we obtain in Step 2.
  • On the Delivery tab, click Outbound Connections. 
  • In the TCP Port box, type 587, and then click OK.
  • On the Delivery tab, click Outbound Security, and then follow these steps:
    > Click Basic Authentication.
    > In the User name box, type the user name of the Office 365 user account that you want to use for sending emails from LOB devices.
    > In the Password box, type the password of the Office 365 user which you have provided in above step.   
    > Select the TLS encryption check box, and then click OK.


    Now settings on Relay server properties are completed, comeback and expand Default SMTP Virtual Server, you will see Domains on left side navigation, right-click Domains > New > Domain and add the domain hosted in Office365.

    Example: Testwindow.com (or) *.com (or) *.Testwindows.com etc and many more based on your requirement.





 Now your SMTP Relay setup is ready and you can test this configuration by sending a test email to office365 user using Telnet.

I can explain it in next blog post,  how to use Telnet command to test email to Office365 using On-premise SMTP Relay.