instagram arrow-down
Kalle Lilja


Create a CatchAll Subdomain – Office365

Using Powershell

By setting up a “catch-all” domain you enable the functionality of receiving ANY email sent to a specific domain, this in turn lets you catch for example any potential lost emails due to misspelling. However, this is in almost all cases a bad idea since based on the fact that if a spamming campaign got a hold of this catch-all domain the server could be victim to a DDoS if no spam protection is in place.
Proceed with caution, keep an eye on the logs.

Anyhow, with the warnings out of the way, lets get started.
The use-case i was faced with was a client who registered lots and lots of external services with unique email addresses that needed to be kept active for verification, password resets, and so on.
The client promptly didn’t want to manage the alias setup internally and liked a solution that didn’t involve daily ticket submissions.
My end goal in this was to end up with a catch-all domain who in turn forwards all incoming email to a set of users via Distribution Group for review.

The logic used will be to set the subdomain up as an InternalRelay, this in turn allows the Exchange server to accept all messages without first verifying the recipient, an essential part of the catch-all process.
The forwarding step will be handled with a Transport Rule, the caveat however is that a transport rule can’t redirect messages to a group natively, we’ll create a Shared mailbox as a middle man, this could of course be a fully featured user mailbox as well if needed.



First and foremost you’ll need to configure and verify the subdomain for use with Office 365 and Exchange Online. This is essentially a repeat of the initial domain setup.

Exchange Online

I’m almost positive every setting needed is exposed to the GUI, so this should be followable that way but I’ll perform the configuration via Powershell.
Start off by connecting to Exchange Online via Powershell.

Adjust the subdomain to act as InternalRelay.

Create the Distribution Group followed by the Shared Mailbox.
Remember to add users to the group as needed.

Lastly, tie it all together with a Transport Rule to handle the forwarding.

I’ve created and distributed a more complete installation procedure/command reference over on GitHub as well as below.