Docs / Email Servers / How to Set Up SPF, DKIM, and DMARC Records

How to Set Up SPF, DKIM, and DMARC Records

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 497 views · 1 min read

Email authentication records prevent your emails from being marked as spam.

SPF Record

Add a TXT record to your DNS:

v=spf1 ip4:YOUR_IP a mx ~all

DKIM

Install OpenDKIM:

apt install opendkim opendkim-tools -y

Generate keys:

opendkim-genkey -s mail -d example.com

Add the public key as a TXT record at mail._domainkey.example.com.

DMARC

Add a TXT record at _dmarc.example.com:

v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com

Verify

Use online tools like MXToolbox to verify all three records are configured correctly.

Was this article helpful?