Responding to a Compromised Email Account in Office 365
December 13, 2019Removing a user from the Restricted Users portal after sending spam email
December 13, 2019When you set up a multifunction device or application to send email through Office 365, there are some cases where the device or application can’t connect directly to Office 365. In these cases, you need to set up Internet Information Services (IIS) to work as an intermediary.
You might want to do this in the following scenarios:
- You don’t have an on-premises messaging system any longer
- You have line-of-business (LOB) programs or devices in an on-premises environment
- Your LOB programs and devices have to send email messages to remote domains and to your Exchange Online mailboxes
Before proceeding, review How to set up a multifunction device or application to send email using Office 365 as there may be an available option that doesn’t require setting up an additional server to relay.
Note
• These instructions can be modified for other SMTP relays that you might have in your organization.
• The SMTP component that’s discussed in this topic is in IIS 6.0, and support for IIS 6.0 has ended with the support of Windows 2003. This article is here for reference purposes, but we recommend that you use a supported version of Exchange Server instead of IIS SMTP. We will continue to do a “best effort support” on this feature, however, no bug fixes or improvements are being made to this product. We can continue to address functionality questions as best we can, but we can’t help with IIS 6.0 product issues or deep technical investigations. Please expect this product to be removed from future versions of Windows.
What you need to know before you begin
- Estimated time to complete: 15 minutes
- Your on-premises domain must be added as an accepted domain in Office 365. For example, if the account you’re relaying from is bob@tailspintoys.com, you have to add tailspintoys.com as an accepted domain in Office 365.
- Your on-premises account must also be either an Exchange Online-licensed user in Office 365 or an alternative email address of an Exchange Online-licensed user. For example, if the account that you’re relaying from is printer@tailspintoys.com and you want to relay through bob@contoso.com (an Office 365 user), you have to add printer@tailspintoys.com as an alternate email address to bob@contoso.com.
Set up Exchange Online as an SMTP Relay Using Windows Server 2012
Step 1: Install Internet Information Services (IIS)
- In Server Manager, select Add Roles.
- On the Before you begin page in the Add Roles Wizard, select Next.
- On the Select Installation Type page, select Role-based or Feature-based installation.
- On the Select destination server page, choose Select a server from the server pool, and select the server that will be running SMTP services. Select Next.
- On the Select Server Roles page, select Web Server (IIS), and then select Next. If a page that requests additional features is displayed, select Add Features and then select Next.
- On the Select Role Services page, make sure that Anonymous under Security is selected, and then select Next.
- On the Confirm Installation Steps page, select Install.
Step 2: Install SMTP
- Open Server Manager and select Add Roles and Features.
- Select Server Selection and make sure that the server that will be running the SMTP server is selected and then select Features.
- On the Select Features screen, choose SMTP Server. You may be prompted to install additional components. If that’s the case, select Add Required Features and select Next.
- Select Install. After the installation is finished, you may have to start the SMTP service by using the Services snap-in for the Microsoft Management Console (MMC).
Step 3: Set up SMTP
- Open Server Manager, select Tools, and then select Internet Information Services (IIS) 6.0.
- Expand the current server, right-click the SMTP Virtual Server, and then select Properties.
- On the General tab, select Advanced > Add.
- In the IP Address box, specify the address of the server that’s hosting the SMTP server.
- In the Port box, enter 25 and select OK.
- On the Access tab, do the following:
- Select Authentication and make sure that Anonymous Access is selected.
- Select Connection > Only the List Below, and then specify the IP addresses of the devices that will be connecting to the SMTP server, such as printers.
- Select Relay > Only the List Below, and then specify the IP address of the devices relaying through this SMTP server
- On the Delivery tab, select Outbound Security, and then do the following:
- Select Anonymous Authentication.
- Select TLS Encryption.
- Select Outbound Connections, and in the TCP Port box, enter 25 and select OK.
- Select Advanced and specify contoso-com.mail.protection.outlook.com as the Smart Host.
Step 4: Restart the IIS service and the SMTP service
Set up Exchange Online as an SMTP Relay Using Windows Server 2008
Step 1: Install Internet Information Services (IIS)
- In Server Manager, select Add Roles.
- On the Before you begin page in the Add Roles Wizard, select Next.
- On the Select Server Roles page, select Web Server (IIS) and select Install.
- Select Next until you get to the Select Role Services page.
- In addition to what is already selected, make sure that ODBC Logging, IIS Metabase Compatibility, and IIS 6 Management Console are selected and then select Next.
- When you’re prompted to install IIS, select Install. You may need to restart the server after the installation is finished.
Step 2: Install SMTP
- Open Server Manager and select Add Roles and Features.
- On the Select Features screen, choose SMTP Server. You may be prompted to install additional components. If that’s the case, select Add Required Features and select Next.
- Select Install. After the installation is finished, you may have to start the SMTP service by using the Services snap-in for the Microsoft Management Console (MMC).
Step 3: Set up SMTP
- Select Start > Administrative Tools > Internet Information Services (IIS) 6.0.
- Expand the current server, right-click the SMTP Virtual Server, and then select Properties.
- On the General tab, select Advanced > Add.
- In the IP Address box, specify the address of the server that’s hosting the SMTP server.
- In the Port box, enter 25 and select OK.
- On the Access tab, do the following:
- Select Authentication and make sure that Anonymous Access is selected.
- Select Connection > Only the List Below, and then specify the IP addresses of the devices that will be connecting to the SMTP server, such as printers.
- Select Relay > Only the List Below, and then specify the IP address of the devices relaying through this SMTP server
- On the Delivery tab, select Outbound Security, and then do the following:
- Select Anonymous Authentication.
- Enter the credentials of the Office 365 user who you want to use to relay SMTP mail.
- Select TLS Encryption.
- Select Outbound Connections and in the TCP Port box, enter 25 and select OK.
- Select Advanced and specify contoso-com.mail.protection.outlook.com as the Smart Host.
Note
• Replace contoso-com.mail.protection.outlook.com with your own tenants mail exchanger address. You can find this by looking for the MX record of your domain in the admin.microsoft.com portal, located in the Setup section.
Step 4 Restart the IIS service and the SMTP service
How do you know this worked?
You can test SMTP relay services without using an separate LOB application or device.
To test SMTP relay services, use the following steps.
- Create a text file using Notepad or another text editor. The file should contain the following code. Replace the source and destination email addresses with the addresses you will use to relay SMTP.Copy
FROM: <source email address> TO: <destination email address> SUBJECT: Test email This is a test email sent from my SMTP server
- Save the text file as Email.txt.
- Copy the Email.txt file into the following folder: C:\InetPub\MailRoot\Pickup.
- After a short time, the file should automatically be moved to the C:\InetPub\MailRoot\Queue folder. When the SMTP server delivers the mail, the file is automatically deleted from the local folder. CautionIf the SMTP server can’t deliver the message, a non-delivery report (NDR) is created in the C:\InetPub\MailRoot\BadMail folder. You can use this NDR to diagnose delivery issues.