Configure Exchange 2013/2016 Send Connector For Office 365 SMTP Relay From On-Premises Exchange Server
You may have a scenario that you have recently migrated to Office 365 but you still require local applications to be able to relay mail for example monitoring alerts. You will need to initially create a receive connector in Office 365 Exchange Online. You will need to login to the console and navigate to Mail Flow and then to Connectors. You will need to click the + Icon and select the options as per the screenshot.
Select Next and type a Friendly name for the connector.
You will then need to confirm the Domain Name of the Subject Name on the Certificate, or Alternatively a range of IP addresses that Office 365 will be receiving e-mails from your On-Premises Exchange.
Ideally at this point you should test to confirm that Office 365 Is listening on port 25 from your e-mail server. You will need your identifier of your Office 365 service, for example Jacob.mail.protection.outlook.com – This will be on your MX Records. So you can Test this by running the below commands
Telnet Jacob.mail.protection.outlook.com 25
If this is successful then Office 365 is listening successfully. At this point I would recommend changing your SPF records to make sure that your Exchange On-Premises Is included, If this isn’t already in place. You will need to make sure that your SPF reads the below If you are only using Office 365 and On Premises Exchange.
v=spf1 ip4:(Your Exchange Server IP) include:spf.protection.outlook.com -all
v=spf1 ip4:18.104.22.168 include:spf.protection.outlook.com -all
You will now need to create the Send Connector on your On Premises Exchange server. You will need to place your MX Record in the Smart Host section. For example Jacob.mail.protection.outlook.com. You will need to leave the Authentication on None as we will be connecting using anonymous authentication.
You will need to also make sure * is in the Domain address space as per the below screenshot.
To relay using anonymous authentication we also need to setup a receive connector. You will need to navigate to receive connectors in your On Premises Exchange server and create one using the following configuration –
Select Next and You can usually select next on this page as below unless you have multiple IP’s on your Exchange Server.
You will then need to complete the below with the IP of your Internal Application. For example 192.168.0.50 and select Finish.
Once you have selected finish you will need to edit the receive connector to change the security settings as per the below screenshot.
Once this is completed, this should allow your On Premises Exchange server to relay to Office 365 correctly, using your Domain name.