如何设置我的MXlogging,使邮件到我的域名去一个地方,邮件到所有子域名去其他地方?

我有一个域名example.com,为此,我希望根据具体情况将邮件路由到不同的服务器。

发送到@ example.com地址的邮件应该到服务器mail.server1.com,并发送到任何子域@ *。example.com应该到mail.server2.com

有没有办法configurationMXlogging来做到这一点(或任何其他方式来做到这一点)? 我可以为MXlogging使用通配符DNS条目吗?

我发现后几乎立即发现了这个答案:)

按预期将example.com的MXlogging设置为mail.server1.com。

然后设置通配符,可以创build一个通配符CNAME * .example.com,它指向一些通用的子域sub.example.com,然后为sub.example.com创build一个指向mail.server2.com的MXlogging。

这一切都取决于您使用的DNS服务器。

在这个例子中绑定:

; zone fragment for 'zone name' example.com ; name servers in the same zone $TTL 2d ; zone default TT = 2 days $ORIGIN example.com. @ IN SOA ns1.example.com. hostmaster.example.com. ( 2003080800 ; serial number 2h ; refresh = 2 hours 15M ; update retry = 15 minutes 3W12h ; expiry = 3 weeks + 12 hours 2h20M ; minimum = 2 hours + 20 minutes ) ; main domain name servers IN NS ns1.example.com. IN NS ns2.example.com. ; mail servers for main domain IN MX 10 mail.example.com. ; A records for name servers above ns1 IN A 192.168.0.3 ns2 IN A 192.168.0.4 ; A record for mail servers above mail IN A 192.168.0.5 ; other domain level hosts and services bill IN A 192.168.0.6 .... ; sub-domain definitions $ORIGIN us.example.com. IN MX 10 mail ; record above uses blank substituition ; and could have been written as ; us.example.com. IN MX 10 mail.us.example.com. ; OR (using @ substitution) ; @ IN MX 10 mail ; A record for subdomain mail server mail IN A 10.10.0.28 ; the record above could have been written as ; mail.us.example.com. A 10.10.0.28 if it's less confusing ftp IN A 10.10.0.29 ; the record above could have been written as ; ftp.us.example.com. A 10.10.0.29 if it's less confusing .... ; other subdomain definitions as required Additional sub-domains could be defined in the same file using the same strategy. For administrative convenience you could use $INCLUDE directives eg ; snippet from file above showing use of $INCLUDE .... ; other domain level hosts and services bill IN A 192.168.0.5 .... ; sub-domain definitions $INCLUDE us-subdomain.sub ; other subdomain definitions as required 

通配符MXlogging完全有效,不需要额外的CNAME。

你可以简单地…

 example.com IN MX 10 mail.server1.com *.example.com IN MX 10 mail.server2.com 

您的CNAME只会导致额外的DNS查询