邮件SPF是什么?The Record That Blocks Spoofing

小影
邮件SPF - Who may send as you

Key Takeaways

  • 邮件SPF is one DNS TXT record with a public sender list.
  • Receivers check the envelope sender, not the visible From line.
  • Every include, a and mx entry costs one DNS lookup.
  • Ten lookups is the practical ceiling for 邮件SPF.
  • A hard fail is the only policy that rejects spoofed mail.

What 邮件SPF records publish

A 邮件SPF record lists the servers allowed to send mail for your domain. You publish it as one DNS TXT record. Receivers read that record before they accept a message.

Think of it as a guest list for your domain. The receiving server asks one narrow question. Did this message come from an approved host?

The record also states a policy. That policy tells the receiver what to do after a failure. The usual choices are hard fail, soft fail and neutral.

A 邮件SPF record is not a spam filter. It answers one question about the sending host. It says nothing about the content of a message.

That narrow focus is a strength. The check is cheap and hard to fake. An attacker cannot easily borrow your domain.

Most large providers now expect a 邮件SPF record. A domain without one looks neglected over time.

How a receiver checks 邮件SPF

The receiver reads the envelope sender, not the visible From header. That single detail explains most confusing results.

The envelope sender is the address used in the SMTP conversation. It is often called the return path. It can differ from the address shown to the reader.

The receiver pulls the domain from that envelope address. Then it queries DNS for a TXT record.

Each mechanism in the record is tested from left to right. The first match stops the walk. That match produces the final result.

The sending server IP must appear in the allowed set. If it does not, the check fails.

Forwarding breaks 邮件SPF often. A mailing list or a gateway rewrites the envelope. The new sender is not on your list.

This is a known limit, not a bug. It is one reason DKIM exists beside SPF.

So a 邮件SPF result describes the last hop. It rarely describes the original author.

Reading an SPF result

There are a few possible outcomes, and they are not equal.

A pass means the host is authorised. The message proceeds as normal.

A hard fail means the record rejects that host. A receiver may reject the message outright.

A soft fail means the domain is unsure. Most receivers accept the message and mark it.

A neutral result means the domain makes no claim. Treat it as no information at all.

A temperror or permerror points to a broken 邮件SPF record. That is a configuration problem, not a spam signal.

You can read the Received-SPF header to see the verdict. It usually names the mechanism that matched.

The header line is added by the receiving server. Different providers phrase it differently. The mechanism name is the part worth reading.

Common 邮件SPF mistakes

Most broken records fail for a handful of reasons.

The first is publishing more than one 邮件SPF record. Two records confuse receivers. Merge them into a single record.

The second is exceeding the lookup limit. Each include, a and mx entry consumes one lookup.

The third is a missing include for a real sender. Every service that sends for you needs a place on the list.

The fourth is a typo in the version tag. It must read v=spf1 exactly.

The fifth is an accidental soft fail. A tilde is not the same as a hyphen.

邮件SPF: Reading a record

Audit the record once a quarter. Senders change, and old includes linger.

Keep the record short enough to read. A long list of stale includes becomes a maintenance burden.

Testing and rolling out 邮件SPF

Start with a record that cannot hurt delivery.

Publish a version that ends in a soft fail first. Watch the results for a few weeks.

Use aggregate reports from your DMARC setup. They show which hosts actually send for you.

Then tighten the policy to a hard fail. Change only one thing at a time.

You can validate a 邮件SPF record with any public checker. Run it again after every change.

Remember that a hard fail can break forwarding. That is a real trade-off, not a defect.

邮件SPF: Records that work and fail

Related reading covers the wider picture on 邮件认证. Allow-list behaviour is explained under 邮件白名单. Placement signals belong with 邮件投递率, and the first checkpoint is described in 邮件网关.

SPF is one of three common checks on an inbound message, and the others matter too.

DKIM signs the message so a receiver can spot changes in transit. DMARC ties the two together and asks for reports. Each check covers a different gap.

SPF alone cannot survive forwarding. DKIM usually can, because the signature travels with the message.

DMARC adds an alignment test. It asks whether the authenticated domain matches the visible From domain. Without alignment, a pass proves very little.

So treat SPF as one layer. It is fast and cheap, and it stops the simplest forgery.

Readers who want the full picture should start with the combined guide. Every record has a separate job, and each one fails in its own way.

FAQ

Is a 邮件SPF record required?

No, but almost every large receiver expects one. A domain without a record looks suspicious over time.

Can 邮件SPF stop all spoofing?

No. It checks the sending host, not the visible address. Pair it with DKIM and DMARC for full coverage.

How many DNS lookups are allowed?

Ten lookups is the practical ceiling. Every include, a and mx mechanism consumes one.

What does a soft fail do?

It tells the receiver to be suspicious. Most still deliver the message, often to the spam folder.

References


延伸阅读

评论

还没有评论,来说两句吧。

评论功能已关闭。