How do I set up SPF and DKIM on Linux?

SPF is pretty straight forward if you know how to add TXT DNS records.

But the syntax can be confusing.

Here is a sample record that adds an IP and Outlook settings:

“v=spf1 a mx ip4:xxx.183.121.155 include:spf.protection.outlook.com -all”

Don’t ask what the difference is between – and ~, but just take it as the most confusing parameter ever.
The difference between the dash and the tilde is:

The tilde and dash identify they different types of failures. Consider a message that doesn’t match the parameters specified in the SPF record. Tilde is for a softfail, the message will be accepted and marked if it doesn’t match parameters specified. Dash is for a hardfail, the message will be rejected if it doesn’t match.


DKIM guide is quite intense but if you follow the exact guide below, and the tip, then you will be good.



If you don’t have a listener on port 8891, then follow the last answer on this post, the one about¬†ExecStart


How to test? Well, when you’re done, send a message to Gmail, reveal entire message, and then look for PASS x 2.

Other guides:

Google SPF:




Include more than one SPF (DON’T ADD 2 X TXT!!!)


Office 365 @ Go Daddy


Google DKIM:



Share this article

Share on facebook
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top