Defining SPF Records for Google Apps and a Custom Domain

Google advises that when using Apps for e-mail your domain should have a SPF/TXT record with the value v=spf1 ~all.

An issue that may arise is e-mail providers marking the message as spam if you are sending e-mail from your web server as well as google's servers. For example, user account registration validation, contact form submissions, and anything that may come from an address such as on a website.

The fix is simple, update your SPF record to contain the domain as well, for example: v=spf1 ~all.

As another example, if you are using an email delivery service such as SendGrid, you could enter the IP (if you have a static one): v=spf1 ip4: ~all, or by replacing the domain above with

Google does have a KB article on this, but it only mentions IP and not domain. By using the record provided in this example, the IP resolved at the A-Record for the domain will be allowed instead of just the IP.

Note: You do not need to include your top-level domain in the SPF policy, it is automatically assumed