New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
SecurityUpdated 4 Nov 2026

Email Spoofing and Phishing: How It Works and How to Prevent It with SPF, DKIM and DMARC

How attackers forge sender addresses and run phishing campaigns, why email accepts forged From headers by default, and the SPF, DKIM and DMARC steps domain owners use to stop abuse of their domain.

KM
Written by Karan Malhotra
API and Developer Experience Lead
Reviewed by Mei Lin Tan
  • Published4 Dec 2023
  • Read time7 min
  • Length1,433 words
Share this guide

Email spoofing is sending a message that appears to come from someone else by forging the sender address. It works because the original email protocol does not verify that the person sending a message is allowed to use the address in the visible From header. Phishing is the common use of spoofing: the forged message pretends to be a bank, a colleague or a supplier to trick the reader into giving up credentials or money.

If you own a domain, you can stop others from sending convincing forged mail in your name. Publish SPF to list your authorised senders, sign mail with DKIM, and publish a DMARC policy that tells receivers to quarantine or reject mail that fails authentication in alignment with your From domain. The rest of this article explains the attack types, what each control does and a safe rollout path.

Root causeSMTP does not check that the From address belongs to the sender
Fix for your domainSPF and DKIM for authorisation, DMARC for policy and reporting
What authentication cannot stopLookalike domains and display name tricks
RolloutMonitor with p=none, fix legitimate senders, then quarantine, then reject

How spoofing works

A mail message has two sender identities. The envelope sender (MAIL FROM, also called the return path) is used for bounces. The From header is what people see. Nothing in the base SMTP specification forces them to match or proves either is honest. An attacker who can speak SMTP to a receiving server can put any address in the From header. Receiving servers decide what to do using authentication checks, reputation and filters.

MAIL FROM:<[email protected]>
RCPT TO:<[email protected]>
DATA
From: "Accounts" <[email protected]>
To: [email protected]
Subject: Invoice overdue
...

Authentication checks compare what the message claims with what DNS says about the claimed domain. For the underlying mechanics see email spoofing and envelope sender. For how the pieces fit, read email authentication explained.

Types of attack

AttackHow it worksDoes SPF/DKIM/DMARC stop it?
Exact domain spoofingForged From uses your real domainYes, with DMARC enforcement (quarantine or reject)
Display name spoofingFrom name says "Your CEO" but the address is a free mailboxNo; this is a different address on a different domain. Needs filters and user awareness
Lookalike (cousin) domainyourcompany-support.com or a character swap such as rn for mNo; the attacker legitimately owns that domain. See lookalike domains
Compromised accountReal mailbox taken over via stolen credentialsNo; mail is genuinely authenticated. See account compromise response
Reply-to hijackLegitimate looking From with attacker Reply-ToPartly; From is not forged but the reply goes elsewhere. See Reply-To
Subdomain abuseSending as unused subdomains or parked domainsYes, with subdomain policy and null records. See parked domains

Business email compromise combines several of these, typically asking staff to change a payment detail. No DNS record prevents it entirely, so combine technical controls with approval processes. For end users, see how to spot phishing.

The three controls

ControlWhat it provesDefined in
SPFThe sending IP is authorised by the envelope sender domainRFC 7208
DKIMThe message was signed by a domain key and was not altered in transitRFC 6376
DMARCEither SPF or DKIM passed and aligned with the visible From domain, and what to do if notRFC 7489

SPF and DKIM alone do not protect the visible From address, because the domains they check can differ from it. DMARC adds the alignment requirement and a published policy. See alignment explained. If you are starting from scratch, follow authenticating your sending domain.

Publish the records

; SPF: list every legitimate sender. Only one SPF record per name.
example.com.            TXT "v=spf1 include:_spf.mailprovider.example -all"

; DKIM: public key published at selector._domainkey
s1._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GN..."

; DMARC: start in monitoring mode and collect reports
_dmarc.example.com.     TXT "v=DMARC1; p=none; rua=mailto:[email protected]; fo=1"

Replace values with those from your providers. Keep SPF under the limit of ten DNS-querying terms. See SPF record syntax, DKIM records and DMARC record syntax. Test your setup with the SPF, DKIM and DMARC checker.

Move DMARC to enforcement safely

  1. Inventory senders. Marketing platform, CRM, support desk, billing, application servers, newsletters, printers and forgotten tools.
  2. Publish p=none with a reporting address. Aggregate reports (rua) show who sends mail claiming your domain. See aggregate reports and moving to reject.
  3. Fix legitimate failures. Add missing SPF includes, enable DKIM signing with your domain for each service, and align the return path where needed.
  4. Move to quarantine at a partial percentage. Use the pct tag to apply policy to part of the mail first. See the pct tag.
  5. Raise to 100 percent, then to reject. Watch reports for new failures after each step.
  6. Cover subdomains. Use the sp tag or per-subdomain records. See subdomain policy.
  7. Protect parked domains. Publish a null SPF and a reject policy on domains that never send mail.
; Enforcement example once reports are clean
_dmarc.example.com. TXT "v=DMARC1; p=reject; sp=reject; rua=mailto:[email protected]; adkim=r; aspf=r"

; Parked domain that never sends mail
parked.example.  TXT "v=spf1 -all"
_dmarc.parked.example. TXT "v=DMARC1; p=reject; rua=mailto:[email protected]"

Mailing lists and forwarders can break authentication, because they alter the message or resend from another IP. Plan for this before enforcing. See DMARC and mailing lists, ARC and forwarding.

Reading a spoofed message

When you receive a suspicious message, the full headers tell you whether authentication passed. Look at the Authentication-Results header added by your own receiving server, not at any similar header that the sender supplied. A forged message that claims your domain will typically show spf=fail or none, dkim=none, and dmarc=fail. See the Authentication-Results header and reading email headers.

Remember that a pass is not proof of honesty. An attacker can send authenticated mail from a domain they own, so a message can pass every check and still be a phishing attempt. Authentication proves which domain is responsible for the message, and the reader still has to judge whether that domain is the one they expect.

For your own domain, DMARC aggregate reports are the best evidence of spoofing attempts at scale. They list sending IPs, volumes and pass or fail results per source, which lets you tell a forgotten internal system from a hostile one. Treat unknown sources with consistently failing mail as candidates for rejection, and unknown sources with passing mail as a prompt to find the owning team.

What authentication does not cover

  • Lookalike domains. Monitor new registrations of similar names, consider defensive registrations for the most obvious variants and report abuse to registrars.
  • Display names. Many mail clients show only the name. Train staff to check the address and configure gateways to flag external senders using internal display names.
  • Compromised accounts. Use strong authentication on mailboxes. See email account security.
  • Brand display. Once you enforce DMARC you can consider showing a verified logo. See BIMI setup.
  • Transport security. Add MTA-STS to protect delivery to your own domain. See MTA-STS and TLS-RPT.

Communicate with staff and partners

Technical controls work best when people know about them. Tell staff and key suppliers which addresses and domains you legitimately use, and publish a short page that explains how you will and will not contact customers, for example that you never ask for passwords by email. When you move to a reject policy, warn partners that run their own mail systems, because a supplier that sends invoices through an unauthenticated tool will see them bounce.

Troubleshooting and monitoring

ProblemLikely causeFix
Legitimate mail fails DMARC after enforcementA sender was not inventoried or is not alignedRead aggregate reports, add DKIM signing for that service
SPF passes but DMARC failsReturn path domain not aligned with FromUse a custom return path. See return path alignment
DKIM fails only for some mailGateway or footer modifies the bodySign after modification or exclude the modifier
No reports arriveWrong rua address or external domain not authorisedCheck the reporting address and reporting authorisation records
Forwarded mail rejectedSPF breaks on forward, DKIM broken by alterationRely on DKIM and ARC where available
Reports are hard to readRaw XMLUse a reporting tool. See DMARC report tools

Review reports weekly while rolling out, then monthly. Re-run your sender inventory whenever a team adds a new tool that sends as your domain. Next steps: publish p=none today if you have no DMARC record, set a date for quarantine and plan reject for every domain you own.

Send authenticated mail from the start Use an SMTP relay with DKIM signing and a return path you can align with your domain.

Explore the SMTP relay

References and further reading

Frequently asked questions

What is email spoofing?

Sending a message with a forged sender address so it appears to come from someone else. Email does not verify the From address by default.

Does SPF alone stop spoofing?

No. SPF checks the envelope sender, not the visible From address. DMARC with alignment is needed to protect the From domain.

What DMARC policy stops spoofing of my domain?

A policy of quarantine or reject, applied after you have confirmed that all legitimate mail passes and aligns.

Can DMARC stop lookalike domains?

No. A lookalike domain is a different domain that the attacker owns, so you need monitoring, defensive registration and user awareness.

How do I roll out DMARC without blocking my own mail?

Start with p=none and aggregate reports, fix every legitimate sender, then move to quarantine and reject in stages.

Topics#spoofing#phishing#spf#dkim#dmarc
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales