Configure IIS as SMTP relay server for Office 365

By: Emiley J Printer Friendly Format    


While migrating to Office 365, one of the issues you will face (and often forgotten) is to support legacy applications or websites that send out emails. For example, a feedback page on the customer website, will have to send an email by connecting to the SMTP server. Or another common scenario is when you have Printers, these printers usually will send emails after scanning, or after receiving a fax etc.. Here is a solution.

After migrating to Office 365 and you remove your on-premise exchange server, you will no longer have any SMTP server to point to. Therefore you can point them to Office 365. The only problem is that Office 365 uses TLS. Therefore some legacy applications may not support it. To resolve this issue you can configure one of your IIS servers to act as an SMTP relay server, so that your printer or applications can point to this IIS server for sending out emails, but your IIS server will just relay these emails to Office 365 server for sending out. The steps below explain how to configure your IIS to act as SMTP relay server for Office 365.

To configure Internet Information Services (IIS) so that your LOB programs can use the SMTP relay, follow these steps:

  1. Create a user who has an Exchange Online mailbox. To do this, use one of the following methods:
    • Create the user in Active Directory Domain Services, run directory synchronization, and then activate the user by using an Exchange Online license.
      Note The user must not have an on-premises mailbox.
    • Create the user by using the Office 365 portal or by using Microsoft Online Services PowerShell Module, and then assign the user an Exchange Online license.
  2. Configure the IIS SMTP relay server. To do this, follow these steps:
    1. Install IIS on an internal server. During the installation, select the option to install the SMTP components.
    2. In Internet Information Services (IIS) Manager, expand the Default SMTP Virtual Server, and then click Domains.
    3. Right-click Domains, click New, click Domain, and then click Remote.
    4. In the Name box, type *.com, and then click Finish.
  3. Double-click the domain that you just created.
  4. Click to select the Allow incoming mail to be relayed to this domain check box.
  5. In the Route domain area, click Forward all mail to smart host, and then in the box, type the mailbox server name.
  6. Click Outbound Security, and then configure the following settings:
    1. Click Basic Authentication.
    2. In the User name box, type the user name of the Office 365 mailbox user.
    3. In the Password box, type the password of the Office 365 mailbox user.
    4. Click to select the TLS encryption check box, and then click OK.
  7. Right-click the Default SMTP Virtual Server node, and then click Properties.
  8. On the Delivery tab, click Outbound Connections.
  9. In the TCP Port box, type 587, and then click OK.
  10. Click Outbound Security, and then configure the following settings:
    1. Click Basic Authentication.
    2. In the User name box, type the user name of the Office 365 mailbox user.
    3. In the Password box, type the password of the Office 365 mailbox user.
    4. Click to select the TLS encryption check box, and then click OK.
  11. On the Access tab, click Authentication, click to select the Anonymous access check box, and then click OK.
  12. On the Relay tab, select Only the list below, type the IP addresses of the client computers that will be sending the email messages, and then click OK.


Ask a Question



Most Viewed Articles (in Office365 )

Change primary e-mail address of a Office 365 user or group

Making your Alias email as 'Send As' in Office 365

The user's Outlook Live mailbox is full.

How to configure Outlook in a staged migration of Office 365

Configure Outlook Manually for Office 365

Email limits and message limitations in Office 365

Change Dirsync synchronization frequency

Outlook Live couldn't sign in to the user account on the IMAP messaging system.

An Outlook Live mailbox wasn't found for the user.

The user's mailbox has already been migrated.

Outlook Live couldn't connect to the IMAP server.

xxxx cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details.

Steps to Create Shared Mailbox in office 365

Error: "the current user is required to be a builtin\administrator directory sync - Office 365 Directory Sync

Configure IIS as SMTP relay server for Office 365

Latest Articles (in Office365)

Comment on this tutorial

Ask a Question

Subscribe to Tutorials

Related Tutorials

Archived Comments

1. Thank you for the information, however port 587 is
View Tutorial          By: Juliet at 2014-09-24 23:56:39

2. Hi! This post could not be written any better! Rea
View Tutorial          By: ig at 2017-04-29 04:31:37

3. I know this if off topic but I'm looking into stta
View Tutorial          By: Cochin Web Host Company at 2017-05-13 11:42:19