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 is my first time setting up SPF records, so I'd just like some experienced eyes to make sure I'm doing this properly.

I have several domains, but I'll focus on one of them:

I have one physical server which is my web server and mail server. Most mail for will actually just be sent via Gmail, but the website running on my server will also send some emails so I want the SPF record to approve both of them.      A      TXT     v=spf a mx ~all      MX      priority: 10

Does this look right?

share|improve this question
up vote 2 down vote accepted

See for the syntax to use when writing your SPF records.

Your SPF record should read v=spf1 +a +mx -all to have the greatest effectivity at blocking bounceback spam due to forged headers.

Additionally, if you're on some kind of shared hosting server, you should ask your hosting provider what IP address(es)? they use for outgoing email and add those to the SPF record using the ip4:, ip6:, or include: mechanisms (as appropriate). If your host is using a smarthost for outbound spam filtering, you should add that server's outgoing IP addresses as well using one of the mechanisms above as instructed by your hosting provider.

share|improve this answer
I don't see much SPF records with a hard fail (-all), it's usually a soft fail (~all). – Alex Jan 10 '13 at 23:13
I'm still using the format I used above without the +s and using the soft fail, but your comment made me notice that I had v=spf instead of v=spf1 which was a serious problem with my entry. – Kenny Wyland Jan 10 '13 at 23:15
v=spf was an issue indeed. – Alex Jan 10 '13 at 23:17

It does look ok.

As long as your servers sending the email has the IP

It's also redundant to put A and MX in your SPF in your case.

Since they are both pointing to the same IP.

On the other hand, if you are using Google Apps for your emails, your MX are wrong.

They should be pointing at Google's servers;

share|improve this answer
I don't think I'm truly using Google Apps to send email. I've just configured my Gmail account to "Also send mail as..." I'm either using the Gmail web interface to send, or sending through postfix running on – Kenny Wyland Jan 10 '13 at 23:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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