Enable mail flow for subdomains in Exchange Online
If you have a hybrid environment, with mailboxes hosted both in Exchange Online and on-premises, and you have subdomains of the accepted domains that only exist in your on-premises environment, you can enable email flow to and from these on-premises subdomains. For example, if you have an accepted domain called Contoso.com, and you enable match subdomains, users can send email to, or receive email from all subdomains of Contoso.com that exist in your on-premises environment, such as marketing.contoso.com and nwregion.contoso.com. In Microsoft Forefront Online Protection for Exchange (FOPE), this feature was called catch-all domains.
If you have a limited number of subdomains, and know all the subdomain names, we recommend setting up each subdomain as an accepted domain by using the Office 365 admin center, rather than using the procedures in this topic. By setting up each subdomain separately, you can have finer control over mail flow, and include unique transport rules for each subdomain. For more information about adding a domain in the Office 365 admin center, see Add your domain to Office 365. > > In order to enable match subdomains, an accepted domain must be set up as an internal relay. For information about setting the domain type to internal relay, see Manage accepted domains in Exchange Online. > > After you enable match subdomains, in order for the service to deliver mail for all subdomains to your organization's email server (outside Office 365), you must also change the outbound connector. For instructions, see Use the EAC to add the domain to your outbound connector.
What do you need to know before you begin?
Estimated time to complete: 5 minutes
You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Domains" entry in the Feature permissions in Exchange Online topic.
For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard shortcuts in the Exchange admin center.
What Do You Want to Do
Use the EAC to set up match subdomains on a domain
In the EAC, go to Mail Flow > Accepted domains, and select the domain.
Verify that Internal Relay is selected.
Select Match subdomains for this domain for sending and receiving emails.
Use the EAC to add the domain to your outbound connector
In the EAC, go to Mail Flow > Connectors.
Under Outbound Connectors, select the connector for your organization's email server, and then select Edit.
Select Scope, and then select one of the following:
Select Route all accepted domains through this connector.
In the Recipient domains section, select New. In the Add domain box, enter a wildcard domain entry for the domain for which you enabled match subdomains. For example, if you enabled match subdomains for contoso.com, enter *.contonso.com as a recipient domain.
If you don't yet have an outbound connector, see Configure mail flow using connectors in Office 365.
Use the Exchange Management Shell to set up match subdomains on a domain
To add match subdomains to a domain that is set up as an internal relay, use this syntax
Set-AcceptedDomain -Identity <Domain Name> -MatchSubdomains $true
This example sets up match subdomains for the contoso.com domain.
Set-AcceptedDomain -Identity contoso.com -MatchSubdomains $true
How do you know this worked?
To verify that you successfully added match subdomains to a domain using the Exchange Management Shell, do the following:
- Run the command
Get-RemoteDomain <Domain Name> | Format-Listto verify the MatchSubdomains setting.