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

So this TEXT record response hardfail

XX.XX.XX.XX => my mail server

v=spf1 ip4:XX.XX.XX.XX ~all

Question is how to create valid SPF record for sending e-mail

  • for my server IP
  • and using google mail servers, i thin problem is witch -all ~all
share|improve this question
FWIW, Google suggest that you should – nickgrim May 7 '12 at 20:41
The ending ~all is used while you are testing your SPF records but don't want them to actually do anything yet. The ending -all is for once they are correct and you want people to reject email that claims to be from you but isn't. – Ladadadada May 7 '12 at 21:14

I used to work for a company that had Google as their main email provider and this is an example of the SPF record.

v=spf1 a mx ip4:X.X.X.X ip4:Y.Y.Y.Y -all

So we could definite additional static IPs that we want to relay through us as well as the Google servers. We also did a lot of Blackberry email so we had a dig command set up to pull the SPF servers for the Blackberry servers. From here we put them in a separate spf record and then included it on the main SPF record. If you don't trust the you can create a similar dig script to show all of the IPs and then cron it and diff the results on an hourly or daily basis.

Below is a small part of that code. I haven't used this in a while but I believe the output should still be the same.

NEW=`dig txt | grep _spf | grep -ve ";" | awk -F\" '{print $2}' | tr ' ' '\n' | sort`
if [ "$PREVIOUS" != "$NEW" ]; then
echo $NEW | nail -r
share|improve this answer
Google search S*CK, 3 hours and only wrong information -- THX , that solve my problem – Userpassword May 7 '12 at 21:55
OK now its working i had receive 4 new email that should be delivery day ego :) – Userpassword May 7 '12 at 23:27
Very glad to hear it! – Eric May 8 '12 at 13:12

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.