Skip to main content
Code and think

Email and SPF

Email and SMTP has been around since 1982. When talking about email you almost cannot avoid a word or two about SPAM. In order to improve the situation there is a SPF. It stands for Sender Policy Framework. SPF is an TXT entry on the domain and it specifies which server can send your emails.

There are tools like Google Admin Toolbox or a more email specialized MX Toolbox. Enter a domain and check the TXT entries.

SPF is a TXT record that looks like:

v=spf1
+ip4:192.168.1.1
+include:_spf.smtp.com
~all
+ PASS (can be omitted)
? NEUTRAL (useful for diagnostics)
~ SOFT FAIL (deliver, but tag it)
- FAIL (reject the message)

For outlook.com it seems SPF value should be:

v=spf1 include:spf-a.outlook.com include:spf-b.outlook.com ip4:157.55.9.128/25 include:spf.protection.outlook.com include:spf-a.hotmail.com include:_spf-ssg-b.microsoft.com include:_spf-ssg-c.microsoft.com ~all

Keep in mind that a domain should only have one SPF record. Otherwise, it will be rejected as invalid.

In my case, I set up outlook.com with custom domain a long time ago (when it was still free). MS hasn't made it straight forward on how set up SPF record in such case, so this post is just for the record.

Reference, Dylan Beattie, wiki