Skip to main content
WisMail

SPF, DKIM, DMARC for Self-Hosted Mail

Published 2026-11-20

Building a mail server and finding that mail to Gmail goes straight to spam is very common. The cause is almost always DNS: receivers need proof that the message really came from you. SPF, DKIM and DMARC provide that proof.

SPF: who may send for the domain

SPF is a TXT record listing the addresses or servers allowed to send. The receiver compares the connecting IP with the list.

example.com.   TXT   "v=spf1 mx -all"

Common mistakes:

  • Two SPF records on one domain are invalid; merge them into one.
  • More than 10 DNS lookups (include, a, mx) make SPF fail permanently. Keep the list short.
  • Staying on ~all forever: move to -all once you are sure of every sending source.

DKIM: a digital signature on every message

The server signs messages with a private key; receivers fetch the public key from DNS to check that the message was not altered and really comes from your domain.

mail._domainkey.example.com.   TXT   "v=DKIM1; k=rsa; p=..."

With WisMail you turn on DKIM for a domain in web administration; the server creates the key, shows the record to create and signs only once DNS returns the right key. The default selector is mail.

DMARC: policy and reports

DMARC ties SPF and DKIM to the From address people see and tells receivers what to do when a message fails.

_dmarc.example.com.   TXT   "v=DMARC1; p=none; rua=mailto:[email protected]"

The order to follow

  1. Correct A, MX and PTR records.
  2. SPF with -all or ~all depending on your confidence.
  3. DKIM, tested with a message to Gmail ("Show original" must say DKIM: PASS).
  4. DMARC p=none for 2 to 4 weeks, read the reports, then raise to quarantine and reject.

Quick checks

dig +short TXT example.com
dig +short TXT mail._domainkey.example.com
dig +short TXT _dmarc.example.com

Note: DMARC reports are sent by receiving servers to your rua address; WisMail does not yet evaluate DMARC on incoming mail, but it does check SPF on incoming mail and sign outgoing mail with DKIM.

Complete sample records, including Autodiscover, are in the DNS guide.

Related documentation

Try it on your own server for 30 days

Install the package, register the trial and test with real users and devices. No payment card needed.