August 14, 2026

How to Configure SPF, DKIM, and DMARC to Stop Email Spoofing

How to Configure SPF, DKIM, and DMARC to Stop Email Spoofing

Why Domain-Level Email Authentication Is Non-Negotiable

Cybercriminals frequently spoof legitimate corporate domains to launch phishing attacks, deceive employees, and scam customers. Without active email authentication protocols, anyone can configure a mail server to send messages that appear to come directly from your domain address. Beyond security risks, major email providers like Google and Yahoo now aggressively block or flag emails sent from domains without proper authentication records.

Securing your email domain requires implementing three foundational protocols: Sender Policy Framework (SPF), DomainKeys Identified Mail (DKIM), and Domain-based Message Authentication, Reporting, and Conformance (DMARC). Together, these records verify the sender identity, guarantee message integrity, and instruct receiving servers on how to handle unauthorized emails.

email spoofing prevention - server room

1. Implement Sender Policy Framework (SPF)

Sender Policy Framework (SPF) is a DNS TXT record that lists every IP address and third-party service authorized to send email on behalf of your domain. When a recipient mail server receives a message, it cross-references the sending server’s IP address against your published SPF record.

To create an effective SPF record, list all legitimately authorized outbound services, including your primary email host, marketing automation tools, CRM systems, and transactional mail services.

  • Identify every platform sending outbound email for your organization.
  • Construct a DNS TXT record starting with v=spf1.
  • Include authorized IP addresses using the ip4: mechanism or third-party include statements like include:_spf.google.com.
  • End the record with ~all (soft fail) during initial setup, later moving to -all (hard fail) once verified.

Avoid published limits: DNS lookups within an SPF record cannot exceed 10. Exceeding this limit causes SPF verification to break completely, resulting in false delivery failures.

2. Enable DomainKeys Identified Mail (DKIM)

While SPF authenticates the sending server IP, DKIM authenticates the email content itself. DKIM attaches a cryptographic digital signature to every outgoing email header. The receiving mail server uses your domain’s public key published in DNS to decrypt the header and confirm that the email was not tampered with in transit.

Setting up DKIM involves generating a public-private key pair inside your email provider or server admin console. The private key remains secure on your sending server, while the public key is added to your public DNS records as a CNAME or TXT record.

  • Generate a DKIM key selector in your email provider’s admin interface.
  • Add the generated public key DNS record to your DNS management system.
  • Enable DKIM signing within your email application dashboard.
  • Verify signing by inspecting outgoing raw email headers for a valid DKIM-Signature block.
email spoofing prevention - email security

3. Enforce Protection with DMARC

SPF and DKIM operate independently. DMARC ties them together by requiring “domain alignment” and establishing clear policy instructions for recipient servers when authentication fails. Without DMARC, an attacker can still bypass SPF by spoofing the user-facing From address while using an authenticated return path.

A basic DMARC TXT record is published at _dmarc.yourdomain.com. It defines how receiving servers should respond to failures and designates an email address to receive structured XML aggregate performance reports.

A phased DMARC deployment protects email flow while enabling full enforcement:

  • Phase 1 (Monitoring): Set p=none to monitor authentication reports without altering delivery. Use aggregate reporting (rua=mailto:dmarc-reports@yourdomain.com) to identify misconfigured legitimate services.
  • Phase 2 (Quarantine): Update policy to p=quarantine once all legitimate outbound email streams pass SPF and DKIM alignment. Unauthenticated messages will move straight to recipients’ spam folders.
  • Phase 3 (Rejection): Transition to full enforcement with p=reject. Recipient servers will immediately block non-compliant emails before reaching the user inbox.

Maintaining Long-Term Email Security

Domain authentication is an ongoing operational commitment rather than a static configuration. Whenever your business adopts new tools—such as a new helpdesk platform or marketing suite—you must update your SPF, DKIM, and DMARC settings accordingly. Periodically reviewing your DMARC aggregate reports ensures unauthorized spoofing attempts are blocked while legitimate business messaging arrives safely in target inboxes.

Want help with this for your own business? Talk to EFerz about Cybersecurity services — or contact us for a free strategy session.

Facebook
Twitter
LinkedIn
Pinterest