Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I am a bit confused about the creation of SPF records.

I have my hosting domain:, this is the hostname of the actual server running postfix etc.

I have configured my DNS like this:
@       A (mail  server IP)
@       MX   10
@       TXT  v=spf1 mx a ~all
hosting A    @
mail    A (mail server IP)

Now do I need to include the in my SPF record?

And when I have another domain on the same server configured like this:
@       A (web server)
@       MX   10
@       TXT  v=spf1 mx a ~all
mail    A (mail server IP)

Does this SPF record need to include

I am running Webmin/Virtualmin but hosting the DNS external. When I send email through the webmail the sender is always

Are these SPF records correct?

share|improve this question

marked as duplicate by MadHatter, dawud, Falcon Momot, Ward, voretaq7 Sep 7 '13 at 4:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

When ISPs check SPF records, they resolve all domains in it to their IP.

So, answer is if 2 of your domains have the same IP then you only need to include one of them. If IPs are different then you need to have both domain defined in your SPF record.

Alternatively you can use ip4 mechanism like so: ip4: using IP address of server where you sites are hosted.

Basically, they way spf works it looks if certain domain allows mail to be send from certain IP.

share|improve this answer
Ah I see what you mean, the wouldn't even need a SPF record then at all? – YesMan85 Sep 6 '13 at 5:39
It would need it. I didn't explain it right.. Easiest way to say it is: first you'll need to understand what servers will be sending your mail on behalf of you domain. Then in the spf record of that domain you can either specify an domain name of that server or it's ip. If has the same ip as Then you record v=spf1 mx a ~all is good, if has different ip, but does use that mailserver you'd need to include a IP4 or another Also if mx record resolves to A record of mailserver, than you are all set. – James S. Sep 6 '13 at 5:54
I think you just have to swap your records. Like this: @ TXT v=spf1 mx a ~all /// @ TXT v=spf1 mx a ~all This way allows mail to be send from mydomain's ip (as in A record, as well from it's own ip (a mx mechanism)). And – James S. Sep 6 '13 at 5:55
You can verify your records by mailing to emails listed here: – James S. Sep 6 '13 at 6:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.