Catch Emails on Subdomains – How to Configure

domain-name-systememaillinode

I'm making a website which uses the subdomain as part of its name, e.g.
really.cool.example (not the actual site, obviously) and have really@cool.example as the support/contact email address.

The website is hosted on Linode and I'm using Linode to manage the DNS. The mail server is on some cPanel provider elsewhere.

  • I have an "A record" for the subdomain really pointing to my Linode's IP address, and can access really.cool.website via a browser.
  • I have an MX record for cool.website (no subdomain) pointing to the server with cPanel and can send and receive emails to & from really@cool.example

So the above is working.

What I want now is to catch emails sent to an incorrect address on my domain. I set up "default email" on cPanel to forward to really@cool.example, and this works for emails like XYZ@cool.example

The bit I need help with is capturing emails to say support@really.cool.example which is an understandable mistake users might make.

If I send an email to support@idontexist.cool.example, I get a bounce back. However, if I send it support@really.cool.example it simply disappears into the ether, presumably because the subdomain really has an A record.

The question is how do I catch this?

I eventually want to redirect all of these domains to really.cool.example:

  • cool.example (i.e. blank/naked)
  • www.cool.example
  • www.really.cool.example

Because that's things users are likely to type by accident, but have not done so yet (I believe there's a few ways of doing this?)

What I'd like to know is:

  1. How I catch emails to support@really.cool.example
  2. What effect the redirects I plan to put in place will have on the email address (will it break what I already have, or even resolve the email wildcard?)

(I usually try to find things out myself, but with DNS it's unbearable not knowing if they are wrong or simply didn't propagate, especially if I'm going to be trying multiple permutations).

EDIT: for clarification:

  1. I want all the captured emails to end up in the same address really@cool.example (which already catches most wrong emails) not that I understand why that matters as surely if I can catch it at a different email address e.g. catch-all@really.cool.example then I can just forward them.
  2. I do not know where in the process I want to catch them, so long as I catch them, and am open to suggestions involving intermediate email addresses, or doing something on the subdomain server, if my goal cannot be achieved purely with DNS settings.

Best Answer

Simple: Set an MX record for real.cool.website and every other subdomain you actually have an A/AAAA or CNAME record for pointing to the cPanel server (and make sure it handles that mail)

For everything else that you want to catch (e.g. misspellings), you can add a wildcard MX entry also pointing to that cPanel server (again making sure it will actually handle this).

You need to add explicit MX records for every name you have DNS records for, as MX wildcards don't match if you have any other records (see this Q&A.

Of course all of this assumes you want your primary mail server to actually handle all mail.

All that said: IMHO you should only really accept mail for real domains you want to have mails - let wrongly spelled and otherwise invalid addresses bounce so that users are aware of their error.

Also note: Any question regarding your cPanel mail server (e.g. how to make it handle subdomains) would be off-topic and are not welcome here.

Related Topic