Anyone can write an email that says it is from ceo@yourcompany.com. Email was built in a more trusting time. Three records in your domain's DNS let receiving mail servers tell the real messages from the fakes.
SPF: who is allowed to send
SPF is a TXT record that lists the servers allowed to send mail for your domain.
v=spf1 include:_spf.google.com include:sendgrid.net -all
This says: Google Workspace and SendGrid may send for us, and -all means everything else should fail. A soft ~all only marks other mail as suspicious.
Common mistake: adding services over the years until the record needs more than 10 DNS lookups. SPF then breaks for everyone.
DKIM: a signature on every message
With DKIM, your mail provider signs each message with a private key. The matching public key sits in your DNS. The receiver checks the signature and knows the message really came through your provider and was not changed on the way.
You don't write DKIM records by hand. Your provider (Google, Microsoft, Mailchimp…) gives you one to paste into DNS.
DMARC: what to do when checks fail
SPF and DKIM only check things. DMARC tells receivers what to do with mail that fails, and asks them to send you reports.
v=DMARC1; p=quarantine; rua=mailto:dmarc@yourcompany.com
p=none: just report. Start here so you can see who sends as you.p=quarantine: put failing mail in spam.p=reject: refuse it. The goal for most domains.
DMARC also checks alignment: the domain in the visible From address must match the domain that passed SPF or DKIM. That is what actually stops spoofing.
Why it matters now
Gmail and Yahoo require SPF, DKIM and a DMARC record from anyone sending in bulk, and more and more providers send unauthenticated mail straight to spam. Even if you only send a few emails, a missing DMARC record makes your domain easy to fake in phishing.
Check your domain
Run your domain through the email security checker. It reads your SPF and DMARC records and tells you, in plain words, what to fix first.