Configure MX record
Estimated time to complete: 5 minutes
After you’ve completed configuration of your hybrid deployment using the Hybrid Configuration wizard, you can direct mail flow through Office 365. To do this, you need to configure the mail exchanger (MX) record to point to the FQDN created for your Office 365 organization. After you change the MX record to point to the Office 365, all email messages for both on-premises and Office 365 recipients will be routed through Office 365. Email messages for on-premises recipients will then be routed from Office 365 to your on-premises organization.
Learn more at: Transport options in Exchange hybrid deployments
How do I do this?
You need to configure the public DNS MX record for your primary SMTP namespace to point to the FQDN created for your Office 365 organization.
The FQDN that you need to use is created automatically when you add your primary SMTP namespace to your Office 365 organization. The FQDN is <domain>.mail.protection.outlook.com where <domain> is your primary SMTP namespace. For example, contoso-com.mail.protection.outlook.com.
To find the FQDN that you should use for your MX record, do the following:
Log on to: Office 365 admin portal
Select the primary SMTP namespace for your Office 365 organization (for example, contoso.com) and then click Domain settings.
On the DNS management page, verify that Exchange Online is listed under Domain purpose. If it's not, do the following:
Under Domain purpose, click Change domain purpose.
Select Outlook on the web for email, calendar, and contacts, and then click Next.
On the next couple pages, you'll see instructions on how to configure MX, Autodiscover, MSOID, and SPF records for your Office 365 organization. Some of these settings don't work when you're configuring a hybrid deployment so we're not going to configure them here. We'll configure hybrid-specific settings later in this topic.
On the Add the following DNS records... page, click Okay, I've added the records.
On the next page, you'll see Some DNS records have to be fixed and one or more DNS records will show an error. You can safely ignore these errors. Click Ignore these errors at the bottom of the page, and then click Finish.
On the Manage domains page, select your primary SMTP namespace again and click Domain settings.
Exchange Online should now be listed under Domain purpose.
In the Exchange Online DNS records table, find the row where Type equals MX. Use the value in the Points to address field. For example, contoso-com.mail.protection.outlook.com.
Don't change the Autodiscover record for your domain to the value in the Exchange Online table. Doing so will prevent your on-premises users from being able to find their on-premises mailboxes.
After you've found the FQDN to use with your MX record, create the MX record in your DNS zone.
For example, the MX record for contoso.com is the following:
Primary SMTP namespace DNS record type MX priority Target
Refer to your DNS host's Help for more information about how to add an MX record to your DNS zone.
How do I know this worked?
To verify that you've configured the DNS MX record for the primary SMTP namespace correctly, do the following on an Internet-accessible computer that can perform DNS lookups.
Open a Windows command prompt.
Run the following command.
nslookup -type=MX contoso.com
The following should be returned if you've correctly configured the DNS record. (Depending on your DNS configuration, it may take an hour or more for changes to DNS to replicate across the Internet.) The IP addresses returned may be different than the addresses in the example below.
Server: dns.corp.contoso.com Address: 192.168.1.10 Non-authoritative answer: contoso.com MX preference = 0, mail exchanger = contoso-com.mail.protection.outlook.com contoso-com.mail.protection.outlook.com internet address = 22.214.171.124 contoso-com.mail.protection.outlook.com internet address = 126.96.36.199
Having problems? Ask for help in the Office 365 forums. To access the forums, you'll need to sign in using an account that's granted administrator access to your cloud-based service. Visit the forums at: Office 365 Forums