SPF

Sender Policy Framework (SPF) lets a receiving mail server check whether a sending server's IP address is authorized by the domain used in the SMTP envelope sender or HELO identity.

Which domain did SPF check?

A domain owner publishes an SPF policy in DNS describing which systems may send mail using that domain. The receiver compares the connecting server’s IP address with that policy.

For ordinary messages, SPF checks the envelope-sender identity used during delivery, often exposed as the Return-Path. Receivers can also check the SMTP HELO identity; it supplies the domain when the envelope sender is empty. These are not the same field as the From address a person sees in their inbox.

That distinction explains why an SPF pass alone does not prove the visible sender domain is genuine. DMARC adds the alignment check between the authenticated identity and the visible From domain.

An SPF failure needs context

Forwarding can change the server that delivers a message. Its IP address may not be authorized by the original envelope-sender domain, causing an otherwise legitimate message to fail SPF. A failure is useful evidence, but it is not a complete verdict on the message.

When setting up SPF, account for the services that actually send your mail. Publish one SPF record per domain and combine the authorized senders there. Multiple SPF records cause a permanent error; they do not add their permissions together.

Sources

See it in practice