uCheckeruChecker
Mark AvrilovPublished updated 10 min read

How spam filters work: from word lists to neural networks

A spam filter decides what happens to a message: inbox, spam folder or rejection at the door. Filters run at mailbox providers, on corporate gateways and inside mail apps, and one message often passes through several of them.


From word lists to machine learning

Early filters relied on banned-word lists and IP blocklists, and spammers got around them quickly by changing spellings and renting new servers. In 2002 Paul Graham published "A Plan for Spam" and proposed a Bayesian approach, where the filter stops hunting for specific words and instead estimates the probability of spam from many features it learns from the user's own mail.

Large providers now rely on machine learning. Google wrote in 2019 that its models, together with other protections, keep more than 99.9% of spam, phishing and malware out of Gmail inboxes, and that TensorFlow added around 100 million blocked messages a day. Among the categories it got better at, Google named image-based messages, emails with hidden embedded content, and new domains hiding a little spam inside legitimate traffic.

In 2023 Gmail replaced the text vectorizer in its spam classifier with RETVec, which resists homoglyphs, invisible characters and keyword stuffing. Google reports a 38% better spam detection rate over the baseline and 19.4% fewer false positives.

How a spam filter is built

A modern filter is not one rule but a chain of checks. Each adds its own signal, and the decision comes from all of them together.

The connection and the sender

Before reading anything, the server looks at the sending IP: is it on a blocklist, and what is its history? An address on a Spamhaus list can be refused outright before the content matters. Greylisting also happens here, when an unfamiliar sender gets a temporary refusal and the server waits for a retry.

Authentication

The server checks SPF, DKIM and DMARC: is the IP allowed for the domain, is the signature intact, does the From domain match the authenticated one. Gmail requires SPF or DKIM from every sender, and since November 2025 it penalizes bulk senders without SPF, DKIM and DMARC up to outright rejection. The setup guide walks through the records.

Reputation and the message itself

The filter weighs the history of the domain and IP, meaning complaints, bounces, trap hits and volume spikes (see the guide to sender reputation). The message gets its own assessment too: subject, text, HTML, links and attachments. More on this layer below.

Recipient reactions

The provider sees what people do with a sender's mail. They open it, reply, rescue it from spam, or complain and delete it unread. Google advises keeping the complaint rate below 0.1% and never reaching 0.3%. "Not spam" is a signal too, telling the filter the recipient wants the message.

Email content filtering: what gets checked

Content filtering examines the message and gives it a score, the spam score. One suspicious word decides nothing; a combination of features does. The glossary entry on email content filtering goes into how the score is built.

SpamAssassin and point scores

Open-source filters such as SpamAssassin and Rspamd run at hosting companies and on corporate servers. SpamAssassin passes the message through weighted rules and adds up the points. By default a message is spam at 5 points, and the documentation calls that quite aggressive, suggesting 8 or 10 for ISPs. Testing services like mail-tester show which rules fired on your message.

Providers, gateways and mail apps

Gmail also has tabs. Promotions is not spam; the message is still in the inbox, just in a separate category. Marketing mail usually lands there. If a recipient drags a message to a different tab, Google's help says this teaches Gmail their preferences over time.

How to get past spam filters

Filters and spammers learn from each other, so evasion tricks go stale faster than you can roll them out. What works is what filters already treat as signs of an honest sender.

  1. Set up SPF, DKIM and DMARC and recheck them after every DNS change in the domain health check.
  2. Clean the list. Dead addresses cause bounces, and abandoned ones turn into traps.
  3. Add one-click unsubscribe per RFC 8058 and a visible link in the body. Someone who cannot find the way out clicks "Report spam".
  4. Mail people who read. Long-silent subscribers get re-engagement first, then a decision.
  5. Warm up new domains and IPs without sudden volume jumps.
  6. Before a big send, run the pre-send checks with your own Gmail, Outlook and Yahoo mailboxes.

If mail is already landing in spam, the steps are in why emails go to spam.

Sources

Filters remember bounces and trap hits for a long time, so dead addresses are better removed before you send. uChecker checks your first 100 addresses at no charge.

spam filtercontent filteringmachine learningSpamAssassinGmaildeliverability

Mark Avrilov · Author

Published Updated