[![Sender Policy Framework](../content/images/2014/12/spf-logo-medium.webp)](https://www.openspf.org/ "Sender Policy Framework")Today, I ran into a "funny" situation where I got caught by my own mail server and DNS configuration. Actually, I'm referring to the [Sender Policy Framework (SPF)](https://www.openspf.org/) and it disallowed that an email would have been delivered on my behalf.

## Delivery Status Notification

Earlier on I wanted to share a document on OneDrive with my client, and was surprised that he didn't get any invitation by email within the usual 5 to 10 minutes. Well, it turned out that the email had been declined with a Delivery Status Notification (SMTP 550):

```
Reporting-MTA: dns;DUB004-OMC2S4.hotmail.com
Received-From-MTA: dns;DUB131-DS14
Arrival-Date: Fri, 12 Dec 2014 03:22:13 -0800

Final-Recipient: rfc822;client@example.com
Action: failed
Status: 5.7.1
Diagnostic-Code: smtp;550 5.7.1 <client@example.com>: Recipient address rejected: Please see https://www.openspf.net/Why?s=mfrom;id=....
```

That's good!

## SPF is configured via DNS

Although SPF is used for mail transfers it is configured in the DNS records of a domain. There you should specify an SPF record, or at least a TXT record with similar content to this:

```
v=spf1 a mx a:kirstaetter.name ptr:smtp.kirstaetter.name mx:smtp.kirstaetter.name -all
```

The explanation of the various mechanisms for the configuration of an outbound mail server is available in the [Sender Policy Framework Record Syntax](https://www.openspf.org/SPF_Record_Syntax). And it is actually not too hard to learn and apply.

## Rather be safe than sorry

In case that you didn't configure SPF for your domain(s) yet. Please, go ahead and do yourself and mainly other internauts a favour and set-up your DNS records accordingly. It doesn't take that much time but improves your reputation as an outbound mail host.
