18 January 2017

Configure SMTP Relay from On-Prem to Office 365

The following steps will guide you through creating a SMTP relay on a server which will allow you to use the Scan to Email functionality on printers/copiers etc, relaying through Office 365.

This is probably the easiest way to get devices emailing out once you've migrated to Office 365.

1. Find a server that you're going to use as the SMTP Relay, go to Server Manager and then Add Roles and Features

2. From Server Manager, click on Tools, then IIS 6.
If you haven't installed this yet, please do so

3. Expand the serer name, right click on SMTP Virtual Server #1 and click on Properties
4. Click Access tab, then Relay.  Then select either specific IPs or select "All except the list below".
5. Click the Delivery tab, then click Outbound Security, tick Basic Authentication, then enter a username and password of an Office 365 mailbox.  This is used for authentication with your Office 365 tenant.
6. Make sure TLS Encryption has been ticked
7. Click Delivery, then Advanced, then enter smtp.office365.com as the Smart Host address.

That is all you need to do to get the SMTP Relay up and running.  To test this is rather easy as well, and it's highly recommended that you test it before configuring devices to send through this relay service.  

Test Relay Service
1. Create a new Notepad document with the following contents

FROM: scantoemail@domain.com (same as the mailbox you're authenticating with)
TO: adam@mydomain.com (email you're sending the test to)
SUBJECT: Test email

Save this as Email.txt.  Copy this .txt file to C:\inetpub\mailroot\Pickup.  It should immediately disappear as it's picked up and sent through the relay.  

If this arrives in your mailbox, then it's all up and running.  Just make sure that when you're configuring printers etc, the send 'from' address needs to be the same address that you're authenticating with on the SMTP Relay server.  If the emails don't match up, it will error out and won't send.  You can setup the devices to send anonymously as well, and the authentication is done on the SMTP Relay server side.