How to configure an SMTP relay for Office 365

Published on 02/25/2015 by Wouter Makkinje

Filed under Office 365, Windows Server

Last modified 03/03/2017

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 5 (1 votes)

This article have been viewed 4468 times

This article describes how to configure a Simple Mail Transfer Protocol (SMTP) relay in Windows Server 2012 R2 to use with Microsoft Office 365.

You may want to do this in scenarios where you no longer have an on-premises messaging environment, such as
Microsoft Exchange Server, and you have on-premise MFP’s or copy machiens that still need to email via SMTP.

In this scenario, you will configure Microsoft Exchange Online as an SMTP relay to send email messages.

Before you get going notice that you will need the following:

  1. A Licensed mailbox with atleast an exchange online license attached.
  2. The login information for this account (Emailaddress + Password)
  3. A Windows Server 2012 R2 Server that the machine or application that needs to email can access.
  4. Office 365 SMTP server address is smtp.office365.com

Install & Configure SMTP Server Feature

  1. Open up Server Manager in your on premise Server.
  2. Go to Manage in the top right and click it. Choose Add Roles and Features
  3. Click Next with Role-Based or feature-based installation selected.
  4. Choose your server and click Next.
  5. For Server Roles just click Next.
  6. On the Features page Scroll down till you see SMTP Server and choose that and hit Next and finally Install.
  7. Next click on the Startbutton and choose Administrative Tools. Click on Internet Information Services (IIS) 6.0 Manager.
  8. Expand SMTP Virtual Server #1 and click on Domains.
  9. Right click and choose New > Domain.
  10. Select Remote domain type and hit Next.
  11. For the name you name it depending on your ending root domain name. So if i have company.com i will name my virtual server *.com
  12. Right-Click your new *.com domain or w.e you named it and select Properties.
  13. Select the checkbox “Allow incoming mail to be relayed to this domain”
  14. Under Route domain, select “Forward all mail to smart host” and type smtp.office365.com
  15. Click on “Outbound Security” 
  16. Within Outbound security select Basic Authentication type in your email address and password for your office 365 account and select the check box for TLS encryption
  17. Next Right-Click on your SMTP Virtual Server and select Properties.
  18. Go to the “Delivery” tab and Click on Outbound Security.
  19. Set the settings as in Step 16 with email adress and password and TLS enabled. Click OK
  20. Next click on “Outbound Connections” still under the Delivery tab.
  21. Change the port to 587. Click OK.
  22. Next go to the “Messages” Tab. Change Limit message size to “15000” Change Limit session size to “30000”

  23. Next Click OK and you’re all done.

On the Copy Machine or Application you can now point to the server as a smtp server and use port 25. In some instances you may need to open port 25 in the windows firewall on the server. Make sure that the application or copy machine has the same emailadress as the office 365 email account or otherwise all your emails will be stacked in the bad mail folder.

Leave a comment if you need any help or clarification.

Leave a Comment