Let's say I want to start a service where customers get their own subdomain on my domain for email addresses only.
I have an A record for mydomain.com and a CNAME for www.mydomain.com
If I add a wildcard MX record for *.mydomain.com, my understanding is that any email coming to my domain will route to the associated mailserver, except for www because CNAME's cannot overlap with MX records.
So email addresses such as
- foo@mydomain.com
- foo@customer1.mydomain.com
- foo@bar.customer1.mydomain.com
- foo@customer2.mydomain.com
Should all work correctly.
- foo@www.mydomain.com
Will NOT work correctly.
Then, in my SMTP mailserver, I can parse the domain out of the email address, and route the message appropriately. Is there anything wrong with this plan?