问题描述
我的域(例如 xyz.com)电子邮件托管在 Gsuite 上。我正在尝试为我的域设置 DMARC。 第一天,我收到了来自多个邮件服务器的汇总报告。 在这些报告中,我发现我的域使用了一些其他服务(订阅、产品评级)。
这些服务通过我的域标头和服务域(例如mail.service.com)向客户发送邮件。所以我使用 SendGrid(CNAME) 为这些服务设置了专用域。 另外,我已经为我的 Gsuite 域创建了 DKIM 并在域面板中创建了记录。
现在一切都很完美,但在汇总报告中,一些记录未能通过 SPF 验证,但 DKIM 通过。为什么 DKIM 通过或 SPF 失败?
这里是示例记录
v=spf1 include:_spf.google.com ~all (main domain)
v=spf1 include:sendgrid.net ~all (email.xyz.com sendgrid)
v=spf1 ip4:149.72.201.23 ip4:149.72.27.244 *(multipal ip4 records)* -all (em1234.xyz.com sendgrid)
以下是汇总报告的两条记录:
<record>
<row>
<source_ip>104.47.56.175</source_ip>
<count>1</count>
<policy_evaluated>
<disposition>none</disposition>
<dkim>pass</dkim>
<spf>fail</spf>
</policy_evaluated>
</row>
<identifiers>
<header_from>xyz.com</header_from>
</identifiers>
<auth_results>
<dkim>
<domain>xyz.com</domain>
<result>pass</result>
<selector>kl</selector>
</dkim>
<spf>
<domain>xyz.com</domain>
<result>softfail</result>
</spf>
</auth_results>
</record>
<record>
<row>
<source_ip>209.85.220.41</source_ip>
<count>1</count>
<policy_evaluated>
<disposition>none</disposition>
<dkim>pass</dkim>
<spf>fail</spf>
</policy_evaluated>
</row>
<identifiers>
<header_from>xyz.com</header_from>
</identifiers>
<auth_results>
<dkim>
<domain>xyz.com</domain>
<result>pass</result>
<selector>kl</selector>
</dkim>
<dkim>
<domain>sendgrid.info</domain>
<result>pass</result>
<selector>smtpapi</selector>
</dkim>
<spf>
<domain>gmail.com</domain>
<result>pass</result>
</spf>
</auth_results>
</record>
解决方法
一个域不能有多个 SPF 记录;您需要将它们组合成一条记录,从您提供的记录来看,它应该是:
v=spf1 ip4:149.72.201.23 ip4:149.72.27.244 include:_spf.google.com include:sendgrid.net ~all
通常,如果您使用的是 DMARC,则不应使用 -all
;短路 DMARC 处理是(或至少是)常见的。您最好使用 ~all
然后告诉 DMARC 基于此拒绝。