Cloudflare SPF Setup

Sender Policy Framework - Step-by-step configuration guide

Prerequisites

  • 已登录 Cloudflare 控制台
  • 已将域名添加到 Cloudflare

Configuration Steps

1

进入 DNS 管理页面

登录 Cloudflare → 选择你的域名 → 点击左侧菜单的 "DNS" → "Records"

2

添加 TXT 记录

点击 "Add record" 按钮

3

配置 SPF 记录

选择类型为 "TXT",Name 填写 "@"(代表根域名),Content 填写 SPF 值

如果已存在 SPF 记录,请编辑而不是新增,一个域名只能有一条 SPF 记录
4

保存并验证

点击 "Save" 保存。DNS 生效可能需要几分钟到几小时

可以使用 dig TXT yourdomain.com 命令验证是否生效

Example Configuration

Example SPF Value

v=spf1 include:_spf.google.com include:spf.protection.outlook.com -all

⚠️ This is an example value. Modify it according to your email service provider's requirements.

Verify Your Configuration

Terminal Command
$ dig TXT yourdomain.com +short

Replace "yourdomain.com" with your actual domain name

Common Mistakes to Avoid

  • 创建了多条 SPF 记录(应该只有一条)
  • 使用 ~all 而不是 -all(建议使用 -all)
  • 忘记添加所有邮件发送服务的 include

Verify Your SPF Configuration

After setting up your SPF record, use our free checker to verify it's correctly configured.

Check Your Domain Now