SPF records detail which servers are allowed to send mail for your domain.
Questions 1-3 really summarise the whole point of SPF: You're supposed to be listing the addresses of all the servers that are authorised to send mail coming from your domain.
If you don't have an exhaustive list at this time, it's generally not a good idea to set up an SPF record.
The individual questions really just help break the list down for you.
- asks you for other domains whose mail servers may relay mail from you; if you have eg a secondary MX server at mail-relay.example.org, and that is the main mail server (MX record) for the domain
example.org, then you should enter
mx:example.org. Your SPF record should include your own domain's MX record under nearly all circumstances (
- asks you for your ip netblocks. If you have colocated servers at 18.104.22.168/28, and your office address space is 22.214.171.124/22, enter
ip4:126.96.36.199/28 188.8.131.52/22. IPv6 space should be added as eg
- if (eg) you also have a machine off in someone else's office that has to be allowed to send mail from your domain, enter that as well, with eg
Your mobile phone recipients are problematic. If they send email by connecting to your mail server using eg SMTP AUTH, and sending through that server, then you've dealt with them by listing the mail server's address in (2). If they send email by just connecting to whatever mail server the 3G/HSDPA provider's offering, then you can't do SPF meaningfully until you have rearchitected your email infrastructure so that you do control every point from which email purporting to be from you hits the internet.
Question 4 is a bit different, and asks what recipients should do with email that claims to be from your domain that doesn't come from one of the systems listed above. There are several legal responses, but the only interesting ones are
~all (soft fail) and
-all (hard fail).
?all (no answer) is as useless as
~all (qv), and
+all is an abomination.
~all is the simple choice; it tells people that you've listed a bunch of systems who are authorized to send mail from you, but that you're not committing to that list being exhaustive, so mail from your domain coming from other systems might still be legal. I urge you not to do that. Not only does it make SPF completely pointless, but some mail admins on SF deliberately configure their SPF receivers to treat
~all as the badge of a spammer. If you're not going to do
-all, don't bother with SPF at all.
-all is the useful choice; it tells people that you've listed the systems that are allowed to send email from you, and that no other system is authorized to do so, so they are OK to reject emails from systems not listed in your SPF record. This is the point of SPF, but you have to be sure that you have listed all the hosts that are authorized to originate or relay mail from you before you activate it.
For more information on SPF records http://www.openspf.org is an excellent resource.
Please don't take this the wrong way, but if you get an SPF record wrong, you can stop a significant fraction of the internet from receiving email from you until you fix it. Your questions suggest you might not be completely au fait with what you're doing, and if that's the case, then you might want to consider getting professional assistance before you do something that stops you sending email to an awful lot of people.
Edit: thank you for your kind words, they're much appreciated.
I can't say how people use SPF records, since that's an essentially non-public decision.
SPF is primarily a technique to prevent joe-jobbing, but some people seem to have started to use it to try to detect spam. Some of those may indeed attach a negative value to your having no SPF record at all, or an overbroad record (eg
a:184.108.40.206/2 a:220.127.116.11/2 a:18.104.22.168/2 a:22.214.171.124/2, which rather sneakily equates to
+all), but that's up to them and there's not much you can do about it.
I personally think SPF is a good thing, and you should advertise a record if your current mail structure permits it, but it's very difficult to give an authoritative answer, valid for the entire internet, about how people are using a DNS record designed for a specific purpose, when they decide to use it for a different purpose. All I can say with certainty is that if you do advertise an SPF record with a policy of
-all, and you get it wrong, a lot of people will never see your mail.
Edit 2 (much later): I'm seeing an increasing number of problem caused by the sole use of
TXT records to store the SPF data. At this point (2014-04-25) more and more applications are looking to see a record of type
SPF, and getting a trifle grumpy if they don't see it. There have even been reports of mail refused by (presumably very cutting-edge) mail servers that were only interested in
SPF-type records. So at this point, I think it's a good idea to have identical