Need some help in setting up a SPF record

  • Posted April 5, 2013

I have setup a SPF record like this: Name - @ Text - “v=spf1 a -all”

But if I do a test using the first SPF Record Testing Tool here:, this is what I get:

" SPF record lookup and validation for:

SPF records are primarily published in DNS as TXT records.

The TXT records found for your domain are: v=spf1a-all

SPF records should also be published in DNS as type SPF records. No type SPF records found.

Checking to see if there is a valid SPF record.

No valid SPF record found of either type TXT or type SPF. "


If you go to the site Mail Tester, if you don’t have a valid SPF record, it generates one for you.

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi, <br> <br>When setting up SPF records you should either authorize it from a specific IP or domain name. <br> <br>For a specific IP address, from which you will be sending emails, add the following TXT type DNS record: <br> <br>“v=spf1 ip4:IP_ADDRESS -all” <br> <br>Make sure to replace IP_ADDRESS with your droplet’s value from where you will be sending emails. <br> <br>If you would also like to send emails from Google’s mailservers (if you are using Google Apps for example): <br> <br>“v=spf1 -all” <br> <br>So putting it all together, if you are sending emails from your webserver and also using Google Apps mailservers: <br> <br>“v=spf1 ip4:IP_ADDRESS -all” <br> <br>Thanks, <br>Bulat. <br>

I forgot to add the quotes around the SPF. The Kitterman tool showed an invalid SPF with all the spaces removed. As mentioned above, this was due to not having double quotes around the TXT value. <br> <br>I added one set of double quotes surrounding the entire SPF value, as shown above, and hit enter to save the changes in the DO DNS editor. <br> <br>A dig command returned quotes around every string, which is clearly not how it looks in the DO DNS admin, and not how I’d added it. <br> <br>Example <br>“v=spf1” “ip4:” “a” <br> <br>Solution <br>Had to delete the TXT record and re-add it in the correct quoted format for the DNS and then wait about 15 minutes. <br> <br>This may be a bug in the DO DNS editing interface trying to be smart and auto quote TXT values, but going crazy and quoting every string independently.

For Google mail, this official Google help doc suggests using ~all instead of -all: <br> <br>

My TXT record is “v=spf1 ip4:ip_address ~all”. But what is the value to be added to TTL field? Is it 3600 or 1800?

And my Laravel 5.4 project’s .env looks:


But it doesn’t send email out and generate: Connection could not be established with host [Connection timed out #110]

Please advise

Just a note to others, the “text” field for DNS needs the quotes around the value, otherwise it will not keep the spaces and merges it into an unusable record. <br> <br>So keep the quotes around it when you put it into a TXT record.

You can add a dmarc record, for this to work properly, specifying the action to take on an spf fail and send you a daily report email.