大网数据广告活动
服务器运维问答

How to catch emails on subdomains

· 52CE 我爱测

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 [email omitted] as the support/contact email address. The website is hosted on Linode and I'm u…

问题原文

原帖链接 · andyhasit · CC BY-SA 4.0

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 [email omitted] 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 [email omitted]

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 [email omitted], and this works for emails like [email omitted]

The bit I need help with is capturing emails to say [email omitted] which is an understandable mistake users might make.

If I send an email to [email omitted], I get a bounce back. However, if I send it [email omitted] 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 [email omitted]
  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 [email omitted] (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. [email omitted] 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.

已采纳解答

原帖链接 · Sven · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-04-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。