Updated Tuesday, October 27, 2020
A popular feature on some email providers is subdomain addressing for mailboxes. These allow mailbox owners creating own sub-addresses on the fly by using the local part (the part left of the @ sign in email address) as a subdomain of the primary email domain.
That is a mouthful, but lets check an example. Taken a mailbox address email@example.com, through configured subdomain addressing, we can now accept mails for it also through firstname.lastname@example.org.
The instructions for configuring DNS records for subdomain addressing are presented at domain setup time as an optional step. As usual, domains using Migadu nameservers have these records preset.
If you have configured your domain before the feature was made available, you should revisit your domain’s DNS setup instructions in the Migadu admin panel. If you are using Migadu DNS, you can Reset Mail Records in the DNS editor which will correctly insert the new records for subdomain addressing.
For subdomain addressing to work, the subdomains of your primary email domain need to return our mail exchange servers in DNS MX lookups made by senders. Instead of configuring each individual mailbox as a subdomain, we can use wildcard DNS records.
Wildcard records use an asterisk (*) in their label and resolve all subdomains for the given lookup type. Your nameservers may or may not support wildcard records.
Please add the wildcard MX records given below into your DNS editor to enable subdomain addressing.
After adding these records, any subdomain of your domain should return Migadu mail exchange servers in DNS MX lookups. If you are comfortable with the command line, you can try it out.
$ dig anything.yourdomain.tld mx +short 10 aspmx1.migadu.com. 20 aspmx2.migadu.com.
If you get a similar output, you are ready to use your subdomain addressing.
Sending From Subdomain Aliases
While cumbersome, you can send from subdomain addressing. When sending from one, remember that the SMTP authentication must still happen with the credentials of the primary mailbox.
To use subdomain addressing for sending in your email client, configure additional sender personas in it. The email client should offer a choice of personas to use when composing messages and automatically preselect them in replies.
Downsides and Limitations to Consider
If you use other mail systems on your subdomains, the wildcard DNS record may conflict them. In such cases, you may want to create some of the actual subdomains (local parts of mailboxes) instead of relying on a wildcard.
Subdomain addressing is not a standard behavior in email systems. While there are already many hacks in email systems, (e.g. automatic forwarding), subdomain addressing is not a very common hack. If you sign up for online services using your subdomain addressing but later intend to switch email provider, you may find yourself in a configuration hell to preserve the addresses.