Email spoofing is the forging of an email sender address to make a message appear to come from someone it does not. Phishing is the fraudulent practice of sending emails that pretend to be from a reputable source to trick recipients into revealing personal information, such as passwords or credit card numbers. When the two combine, a spoofed phishing email can look like it came from your bank, your boss, or a trusted vendor, which is why it works. The technical defenses that stop most of this are SPF, DKIM, and DMARC—three email authentication standards that verify a message really came from the domain it claims to use. This article explains what each one does, how they work together, and how to set them up so your domain cannot be used for spoofing.
How Email Spoofing Works
Email was designed in the 1970s, long before security was a concern. The protocol that sends email, Simple Mail Transfer Protocol (SMTP), does not require the sender to prove they own the address they are using. In a standard email client, you can type any address in the “From” field and send it. Most mail servers do not check that the address matches the actual sender. That is why spoofing is trivially easy at the technical level.
Phishers use spoofing to gain trust. For example, an attacker might send an email that appears to come from support@yourbank.com asking you to “verify your account” by clicking a link. The link goes to a fake login page that looks identical to the bank’s real one. If you enter your password, the attacker captures it. Spoofing is the disguise; phishing is the con.
There are two types of spoofing: direct and display-name. Direct spoofing forges the actual email address in the “From” header. Display-name spoofing only changes the displayed name (e.g., “Your Bank”) while the actual address is a random Gmail account. SPF, DKIM, and DMARC only stop direct spoofing—they cannot stop display-name spoofing because the underlying address is legitimate. To stop display-name spoofing, you need user education and mail client filters that flag mismatches.
What Is SPF (Sender Policy Framework)?
SPF is a DNS record that lists which mail servers are authorized to send email for your domain. When a receiving mail server gets a message claiming to be from yourdomain.com, it looks up the SPF record for that domain. The record contains IP addresses or hostnames. If the sending server’s IP is in the list, the check passes; if not, it fails.
An SPF record is a TXT record in DNS. A basic example looks like this:
v=spf1 ip4:192.0.2.1 include:_spf.google.com ~all
This says: “This domain sends mail from IP 192.0.2.1 and from Google’s servers (if you use Google Workspace). The ~all at the end means “soft fail” for any other server—treat it as suspicious but not necessarily reject. A hard fail would be -all, which tells receivers to reject anything not listed.
SPF alone is useful but not sufficient. It only checks the envelope sender (the return-path address), not the visible “From” header. An attacker can spoof the visible “From” while using a different envelope address that passes SPF. That is why DKIM and DMARC exist.
What Is DKIM (DomainKeys Identified Mail)?
DKIM uses digital signatures to verify that an email was not altered in transit and that it actually came from the claimed domain. The sending mail server signs the email with a private key. The public key is published in the domain’s DNS as a TXT record. The receiving server fetches the public key, decrypts the signature, and checks that the hash of the message matches. If it does, the DKIM check passes.
A DKIM signature is added to the email headers, typically as something like:
DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=selector; bh=...; h=from:to:subject; b=...
The d= field is the domain that signed the message. The s= is the selector, which tells the receiver which public key to fetch from DNS. The public key record looks like:
selector._domainkey.example.com TXT v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC...
DKIM is more robust than SPF because it cryptographically ties the message to the domain, and it survives forwarding (as long as the forwarding server does not break the signature). However, DKIM alone does not tell the receiver what to do if the signature fails. That decision is made by DMARC.
What Is DMARC (Domain-based Message Authentication, Reporting & Conformance)?
DMARC is a policy that tells receiving mail servers how to handle messages that fail SPF and DKIM checks. It also provides reporting so you can see who is sending email using your domain. DMARC is published as a DNS TXT record at _dmarc.yourdomain.com.
A basic DMARC record looks like:
v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com; pct=100
The p= field is the policy: none (monitor only), quarantine (send to spam), or reject (block entirely). The rua field is where aggregate reports are sent. You can also use ruf for forensic reports.
DMARC works by aligning the “From” domain with either SPF or DKIM. For SPF alignment, the domain in the envelope sender must match the “From” domain (or be a subdomain). For DKIM alignment, the d= domain in the DKIM signature must match the “From” domain. If neither aligns, the DMARC check fails, and the receiving server applies the policy.
The recommended rollout is to start with p=none, monitor reports, fix any legitimate senders that fail, then move to p=quarantine, and finally p=reject.
How to Set Up SPF, DKIM, and DMARC
Setting up these records requires access to your domain’s DNS settings. The exact steps vary by provider, but the general process is:
- Create an SPF record. List all mail servers that send email for your domain. Include your own server’s IP, plus any third-party services (e.g., your email marketing platform). Never have more than one SPF record—if you do, it fails. Use
include:for third parties. - Generate a DKIM key pair. Most email services (like Google Workspace, Microsoft 365, or your email hosting) provide a DKIM key in their admin panel. You copy the public key into DNS as a TXT record under the selector they give you.
- Publish a DMARC record. Start with
p=noneand an email address for reports. After a week or two, review the reports to see if any legitimate mail fails. If all is clean, change top=quarantine, then later top=reject. - Test your setup. Send a test email to a Gmail or Outlook address and check the headers. Look for
spf=pass,dkim=pass, anddmarc=pass. You can also use free online checkers that analyze your DNS records.
Common mistakes include: having multiple SPF records (which causes a permanent error), using ~all when you meant -all, forgetting to include all third-party senders, or setting DMARC to reject before verifying that all your legitimate mail passes.
Common Problems and Misconceptions
Myth: SPF, DKIM, and DMARC stop all spoofing. They only stop direct domain spoofing. Display-name spoofing, where the actual address is a free service like Gmail, is not affected. Also, if you do not publish these records, attackers can spoof your domain with impunity. If you do publish them, they cannot (unless they compromise your DNS or mail server).
Problem: Forwarding breaks SPF. When an email is forwarded, the original envelope sender is often replaced with the forwarding server’s address, causing SPF to fail. DKIM usually survives forwarding, so DMARC can still pass if DKIM aligns. This is why DKIM is crucial.
Problem: Subdomains. DMARC applies to the organizational domain by default, but you can specify a subdomain policy with the sp= tag. If you have subdomains that don’t send mail, set sp=reject to prevent spoofing of those.
Misconception: DMARC is a spam filter. DMARC is an authentication protocol; it does not judge content. It only verifies that the message came from the claimed domain. It works alongside spam filters, not instead of them.
Comparing SPF, DKIM, and DMARC
Think of the three as layers of a security system:
- SPF is like a guest list at the door—it checks if the person (IP) is allowed in.
- DKIM is like a wax seal on a letter—it proves the letter wasn’t opened and was sent by the person who sealed it.
- DMARC is the bouncer who decides what to do if the guest isn’t on the list or the seal is broken—let them in, put them in a holding area, or kick them out.
SPF alone can be spoofed by using a different envelope sender. DKIM alone doesn’t tell the receiver what to do on failure. DMARC ties them together and gives a clear policy. All three are needed for robust protection.
Costs and Alternatives
Implementing SPF, DKIM, and DMARC is free—you only need DNS access. The main cost is time and expertise. Many email hosting providers offer guided setup wizards. If you lack technical staff, you can hire a consultant, but that is not required.
Alternatives to these standards are limited. BIMI (Brand Indicators for Message Identification) is a newer standard that displays your logo in supported mail clients, but it requires DMARC to be at quarantine or reject. There is also MTA-STS (SMTP MTA Strict Transport Security) which encrypts email in transit, but it does not prevent spoofing. The best additional measure is user training—teach people to check the actual email address, not just the display name, and to verify unusual requests via a second channel.
Frequently Asked Questions
What is the difference between spoofing and phishing?
Spoofing is the act of forging an email address to make it look like it comes from someone else. Phishing is the broader scam that uses that forged email to trick you into giving up information. Spoofing is a technique; phishing is the crime.
Can SPF, DKIM, and DMARC stop all spoofing?
No. They stop direct domain spoofing, where the attacker forges your exact domain. They do not stop display-name spoofing, where the attacker uses a free email service but changes the display name to look like you. They also do not stop lookalike domains (e.g., using “rnicrosoft.com” instead of “microsoft.com”).
What does “p=none” mean in DMARC?
It means “monitor only.” The receiving server will not take any action against emails that fail DMARC; it will only send you a report. This is the recommended starting point to see what legitimate mail you have before enforcing a stricter policy.
How long does it take for DMARC to work?
DNS changes propagate within minutes to a few hours, but you should wait at least 48 hours before changing your policy. Then monitor reports for a week or two to ensure no legitimate mail fails.
What if I don’t set up these records?
Attackers can spoof your domain freely, and your emails are more likely to be marked as spam by receivers. Setting up SPF, DKIM, and DMARC is a best practice for any domain that sends email.