Pelicanux

Just A Few Random Words

Sender Policy Framework

Hotmail filters my (legitimate) E-mails as SPAM!!

Being quite surprised to notice that each time I send E-mails to people who have the nasty habit of having hotmail addresses, they are filters as SPAM, I decided to take a few minutes to have a deeper look into this shit.

It appears that hotmail considers as spam mails from unknown domains. A simple Google search shows this. About that, the first suggestion appearing after why hotmail is why hotmail is bad.

According to its documentation, hotmail claims using a lot of sophisticated technics to distinguish spam vs legitimate mails. Bullshit! As they anyway will regard e-mails sent from unknow domains as spam no matter what. Among all the websites telling about this crap, I like this article and the saying: I […] think Hotmail users should be warned that Microsoft are choosing not to send their emails to them!

The only winning way seems to sign-up to the Microsoft sender ID program, here is a link. But people over the Internet clams it to be inefficient.

Anyway, I decided to create a SPF DNS record for my domain. It basically boils down to a simple TXT field in DNS configuration. Here is mine:

1
2
3
4
5
6
$ dig -t SPF pelicanux.net +short
"v=spf1 mx a ip4:5.39.82.22/32 ~all"

# Because some people only check TXT field
$ dig -t TXT pelicanux.net +short
"v=spf1 mx a ip4:5.39.82.22/32 ~all"
  • v stands for the version, only spf1 is implemented
  • mx tells that MX listed servers can send mails.
  • a tells that the following IP address can send mails.
  • all stands for the action to be taken if conditions are not met:
  • ~all: softfail: non compliant will still be accepted, but marked as spam (If you receive my emails from weird location (outside my company, from another domain,…) please do not drop them, but at least put them in spam folder).
  • ?all: neutral: will probably be accepted, but receiver SMTP server may perform some additional checks (content,…)
  • -all: Reject it! I mean, if my emails are sent from a weird location I prefer you delete them without any further thought.

Notice that this still entirely depend on the receuver policy; he/she may still perform checks, drop, or mark as spam received e-mails, even if they pass this check. (And marking as spam is typically what hotmail does).

spfquery.py is a nice tool to check whether your fields are properly set:

1
2
3
4
5
spfquery.py -ip 5.39.82.22 -sender philippe@pelicanux.net -rcpt-to philippe@pelicanux.net
pass
()
('spfquery:', 'domain of pelicanux.net designates 5.39.82.22 as permitted sender')
('Received-SPF:', 'Pass (spfquery: domain of pelicanux.net designates 5.39.82.22 as permitted sender) client-ip=5.39.82.22; envelope-from="philippe@pelicanux.net"; receiver=spfquery; mechanism=mx; identity=mailfrom')

Here are some web services that may help you building your own SPF: spfwizard.net or check it with this form and of course the zytrax.com documentation page.