What is an SPF record?
When should I use an SPF record?
SPF records are used to provide "external" email servers with a means of checking whether the email they receive has actually been sent from the server indicated in the headers.
In our documentation, when we refer to SPF records, we mean SPF records in their TXT format.
- SPF records for GandiMail and Web Hosting for GandiMail
@ 10800 IN TXT "v=spf1 include:_mailcust.gandi.net ~all"
- for Web Hosting
@ 10800 IN TXT "v=spf1 include:_spf.gpaas.net ~all"
- for Gandimail + Web Hosting
@ 10800 IN TXT "v=spf1 include:_mailcust.gandi.net include:_spf.gpaas.net ~all"
"Web Hosting" records should only be used if you're sending emails from your website (via a contact form, for example).
If you are sending emails via servers (Gandi's or others, other than Web Hosting or Simple Hosting), you can also add the IP addresses of these servers to your SPF record:
Important:
When sending emails from a Web Hosting or Simple Hosting instance, be sure to only use the records listed above.
Example of IP address usage
@ 10800 IN TXT "v=spf1 include:_mailcust.gandi.net include:_spf.example.com ip4:217.70.176.0/21 ip6:2001:4b98:c::/48 ip4:217.70.184.158 ip4:217.70.185.10 ip4:217.70.186.165 ip4:155.133.132.131 ip4:155.133.138.131 ptr ~all"
As you can see from the example above, you can combine IPv4 and IPv6 addresses, either individually or in intervals.
Don't forget that you only need one SPF record, so you need to put all the data in that one record.
Example of a "Mixed" SPF:
@ 10800 IN TXT "v=spf1 include:_mailcust.gandi.net ip4:217.70.184.158 ip6:2001:4b98:c::/48 ~all"
Of course, you may also need to use email servers or cover servers "external" to Gandi to send email. In this case, your SPF record might look something like this:
For example, if you use Gandi's mail servers and your own servers, your record could look like this:
@ 10800 IN TXT "v=spf1 include:_mailcust.gandi.net include:_spf.example.com ip4:217.70.176.0/21 ip6:2001:4b98:c::/48 ip4:217.70.184.158 ip4:217.70.185.10 ip4:217.70.186.165 ip4:155.133.132.131 ip4:155.133.138.131 ptr ~all"