email - Azure 应用程序的 CNAME 导调用子邮件出现问题,MX 和 A 记录被忽略

标签 email azure dns cname mx-record

我们有一个在 Microsoft Azure 上运行的应用程序,并设置了 CNAME 记录来覆盖该域,因此我们可以获得漂亮的 URL http://example.com (请注意,我在整个过程中将我们的真实域名替换为 example.com)。

CNAME
mydomain.com -> mydomainapp.cloudapp.net

我们已正确设置 MX 和 A 记录,因此 MX 包含 mailserver.example.com 和将邮件服务器指向正确 IP 地址的 A 记录。

MX
mailserver.example.com

A
mailserver -> 198.168.111.111 (note this IP is fictitious)

一切都很好,对于大多数电子邮件,但对于某些邮件服务器(尚不确定是什么技术),他们现在使用 CNAME 而不是 MX 和 A 记录。

因此,一封电子邮件发送至 [email protected]实际上发送到[email protected]其中 example.cloudapp.net 是我们使用 CNAME 映射的 Azure 上的域。

EMAIL TO: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="412b24333338012439202c312d246f222e2c" rel="noreferrer noopener nofollow">[email protected]</a>
BECOMES: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="aac0cfd8d8d3eacfd2cbc7dac6cfcbdada84c9c6c5dfcecbdada84c4cfde" rel="noreferrer noopener nofollow">[email protected]</a>

我能找到的唯一建议只是说不要有域级 CNAME 或根本不使用 CNAME,但是当然 Azure IP 地址可以更改,因此我们必须使用 CNAME。我们可以为所有内容添加前缀 www.example.com,但肯定有更好的解决方案。

非常感谢任何想法。

最佳答案

无法在域级别使用 CNAME 记录,因为 CNAME 是所有 RR 类型的别名,因此它始终会导致 MX、SOA、NS 等查找的重定向也是如此。

以下摘录自 RFC1912 第 2.4 节,说得非常清楚:

A CNAME record is not allowed to coexist with any other data. In
other words, if suzy.podunk.xx is an alias for sue.podunk.xx, you
can't also have an MX record for suzy.podunk.edu, or an A record, or
even a TXT record. Especially do not try to combine CNAMEs and NS
records like this!:

       podunk.xx.      IN      NS      ns1
                       IN      NS      ns2
                       IN      CNAME   mary
       mary            IN      A       1.2.3.4

This is often attempted by inexperienced administrators as an obvious way to allow your domain name to also be a host. However, DNS servers like BIND will see the CNAME and refuse to add any other resources for that name. Since no other records are allowed to coexist with a CNAME, the NS entries are ignored. Therefore all the hosts in the podunk.xx domain are ignored as well!

因此,您不得mydomain.com 使用 CNAME 记录!

因此,您必须为 mydomain.com 设置 A 记录(根据需要在 MX:s 和其他记录中),因为这是唯一有效的 DNS 解决方案。

关于email - Azure 应用程序的 CNAME 导调用子邮件出现问题,MX 和 A 记录被忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15886288/

相关文章:

c# - 显示内部服务器错误?

eclipse - 如何在 azure 中测试我发布的 restful web 服务

Go 传输连接在 DNS 更改时保持事件状态

iphone - 如何在xcode上创建电子邮件表单?

java - 使用 Gmail API 发送的电子邮件偶尔会阻止 Gmail 帐户

javascript - 发送网格 - 当我使用 api 发送电子邮件时,我收到的电子邮件缺少所有设计,例如只显示文字

azure - 在 Azure Kubernetes 服务上安装 NGINX Controller

php - 在 laravel 5 的 .env 文件中哪里插入 SES key 、 secret 、SMTP 用户名、SMTP 密码?

database - HTML5数据库和localStorage是否可以跨子域共享?

amazon-web-services - AWS Route53 - 委托(delegate)子域