Preventing email spoofing with an SPF record

A doorman checks a list before letting a courier in

You don’t want to think about your customers or suppliers receiving spam that seems to come from you. Setting up the Sender Policy Framework (SPF) helps prevent others from misusing your domain name to send spam on your behalf. But did you know that an incorrectly configured SPF record can also cause problems?

What is SPF?

SPF is a system that lets the origin of incoming emails be verified: does an email really come from the server it claims to come from? The system does not stop you from receiving spam yourself, but it is a way to improve the delivery of your outgoing email. Provided it is set up correctly, that is of course only courteous towards your business contacts!

Different levels

You can set up your SPF record so that other servers may only accept your emails if they were sent through your sending servers. You do this by registering the authorised sending servers in a TXT record in the Domain Name System (DNS). In effect, it is a short list of IP numbers that are allowed to send mail in your name.

A less strict variant of this setting is to let other servers also accept mail that was not sent through your sending servers, except that this mail will then be marked as spam more readily. Because of the increasingly common scams in which legitimate sender addresses are misused, Onlinespamfilter looks strictly at the SPF record, and a mismatch is always marked as spam.

SPF and working from home

Setting up an SPF record can, however, also have unwanted side effects. If employees regularly work from home, for example, and send email through a private provider, that can undermine the effect of your SPF record.

SPF and forwarding

Another problem arises when employees set up a ‘forward’ to, for example, a Gmail address. Because the forwarded mail, which comes from your customer for instance, is sent through your server, the SPF check makes it end up in the spam folder.

The only thing you can do to prevent the latter is to rewrite the sender address automatically at the moment you have emails forwarded. Forwarded messages are then delivered properly, but the big drawback is that you can no longer see where the original message came from. You can only reply to yourself.

Do it right or don’t do it

All in all, SPF is a very useful framework for protecting your contacts against forged emails, provided you know exactly where all the emails sent on behalf of your organisation come from, and all users play by the rules. After all, SPF is a measure that helps others, and so probably not your top priority.

So first map your mail infrastructure very precisely, to be sure that your employees only send mail through your own mail servers. Did you ever switch on your SPF record without looking into it? Then you are better off switching it off until your internal infrastructure is in order.

Alternatives

To get around the forwarding problem there are alternatives to SPF, such as DKIM and S/MIME: protocols that let you give your email a mark of authenticity. However, many mail clients do not check for these yet, so they won’t get you very far. Until there is another solution for forwarding – and in our view that is a dying practice – you are better off having no SPF record at all than a badly functioning SPF!