使用Amazon SES和Google Apps的正确SPF记录是什么?

23

如何正确设置同时适用于Amazon SES和Google Apps的SPF记录:

Google Apps 建议在记录中使用波浪号“~”:http://support.google.com/a/bin/answer.py?hl=en&answer=178723,但大多数其他示例使用破折号“-”。

Amazon 要求:"v=spf1 include:amazonses.com -all"

Google 要求:"v=spf1 include:_spf.google.com ~all"


我们当前的设置是将两者组合在一起:

TXT "v=spf1 include:amazonses.com include:_spf.google.com ~all"

SPF "v=spf1 include:amazonses.com include:_spf.google.com ~all"


1)这是正确的SPF记录吗?

2)我们是否遗漏了什么,这个记录对于TXT和SPF DNS记录来说应该完全相同吗?这是我们唯一拥有的内容,我们没有其他内容。

我们只从Google Apps和Amazon SES发送电子邮件,没有其他来源。


不,我仍然不确定。我不太确定如何确保它正在工作。我相当确定SES可以工作,但是谷歌没有正确验证。当然,电子邮件仍然可以发送和接收,但我无法确定SPF是否真正起作用。 - Random5000
我设置了SPF记录,对我来说运行良好。你的记录没问题。 - Flappy
1
http://willwarren.com/2014/04/21/setting-spf-records-google-apps-amazon-ses/ - Arto Bendiken
1
根据http://serverfault.com/questions/682467/route-53-should-i-duplicate-my-spf-records-as-txt-records/682495,你应该将其列为DNS中的TXT记录,而不是SPF。 - Sean Bannister
3个回答

23
  1. Publish a TXT record:

    "v=spf1 include:_spf.google.com include:amazonses.com ~all"
    

    Amazon SES documentation says that no additional SPF configuration is required for a domain, but it turns out that adding include:amazonses.com to the record makes Sender ID pass as well. Even though Sender ID is considered obsolete, some receivers could implement it.

    If Amazon SES is configured to use a custom MAIL-FROM subdomain, publish another TXT record for the subdomain:

    "v=spf1 include:amazonses.com ~all"
    

    It's good to have a custom subdomain set up for better deliverability and customer experience. For example, the domain will be displayed in the mailed-by field in Gmail.

    You can use -all instead of ~all. In this case, emails sent from sources not covered in SPF record may be rejected by recipients.

  2. According to Section 3.1 of RFC 7208:

    SPF records MUST be published as a DNS TXT (type 16) Resource Record (RR) [RFC1035] only.

    Thus, SPF record type is now obsolete.

  3. Regarding your comment, here is one simple way to test whether SPF works:

    • Send emails to check-auth@verifier.port25.com from both Gmail and Amazon SES Test Email form.
    • Afterwards, search the automated reply for SPF check: pass.

3
我同意你的看法,亚马逊表示不需要更改 SPF 记录,但我发现,如果在 SPF 记录中包含 amazonses.com(如下所示:"v=spf1 include:_spf.google.com include:amazonses.com ~all"),则 check-auth@verifier.port25.com 的 Sender-ID 检查会从 softfail 变为 pass。我认为这并没有提高投递成功率,但是通过检查可能更加规范。 - triadiktyo
1
@triadiktyo - 我也在想同样的事情。有一个通过的感觉肯定更好。 - Olaf
2
@triadiktyo:这是一个很好的发现。我已经相应地更新了帖子。给未来的读者注意:port25不再验证发件人ID。 - Vitaly Kuznetsov
请注意,用于定制SES邮件发件人的单独TEXT记录将具有不同的名称子域,即您在设置自定义发件人时告诉SES的子域。 - user984003

12

正确的方法是在SPF中包含每个发件人,关于“-”或“~”,它们是SPF属性。

"-" = 仅允许列出的主机发送

"~" = 列出的主机应发送,但可能存在其他发件人。

如果您100%确定已拥有所有列出的发件人,则可以将“~”更改为“-”,但不应同时保留两者。

TXT "v=spf1 include:amazonses.com include:_spf.google.com -all"

http://www.open-spf.org/SPF_Record_Syntax/


2
亚马逊SES不是明确表示您无需为SPF做任何操作吗?请参阅http://docs.aws.amazon.com/ses/latest/DeveloperGuide/authenticate-domain.html - user1480192
1
@user1480192 不是必须的,但最好这样做。如果您想要发送的电子邮件来自您自己的域而不是AmazonSES,或者如果您希望您的电子邮件通过DMARC测试,则必须这样做。 - Eborbob

-1
经过多个月的尝试,我终于成功创建了正确的SPF记录,并防止我的亚马逊邮件被归类为垃圾邮件。我发现了SPF语法验证器的存在。使用验证器和SPF策略测试工具,我能够创建符合我的要求的SPF记录。
Gmail:
v=spf1 ip4:199.255.192.0/22 ip4:199.127.232.0/22 ip4:54.240.0.0/18 ip4:69.169.224.0/20 a:amazonses.com include:_spf.google.com +mx ?all

Yandex:

v=spf1 ip4:199.255.192.0/22 ip4:199.127.232.0/22 ip4:54.240.0.0/18 ip4:69.169.224.0/20 a:amazonses.com include:_spf.yandex.net +mx ?all

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接