Sub topic 8
The filtering stack: from connection checks to machine learning
This chapter assumes you know what SPF, DKIM, and DMARC are, and that you have read the earlier chapters on authentication and sender reputation. Here you will see how a mailbox provider combines those signals with others, in a fixed order, to reach a verdict.
Filtering happens in layers
A receiving provider does not run one spam test. It runs a series of checks. Cheap checks run first and can reject a message before the provider spends effort on expensive ones. Later checks look at more detail and produce a score or a label instead of a hard yes or no.
Layer 1: connection checks
These run during the SMTP conversation, before the message body is transferred. The provider looks at the connecting IP address and the way it behaves.
- Does the IP have reverse DNS (a PTR record) that points to a hostname, and does that hostname resolve back to the same IP?
- Does the server's
HELOname look legitimate? - Is the server opening too many connections, or sending faster than the provider allows?
- Is the connection encrypted with TLS?
Failures here usually produce an SMTP reply code during the session. A 4xx code asks the sender to retry later. A 5xx code is a permanent refusal.
Layer 2: authentication and blocklists
Next the provider checks SPF against the connecting IP, verifies the DKIM signature, and evaluates DMARC. It also checks the IP and the domains in the message against blocklists, which are lists of addresses and domains that other operators have flagged for abuse.
A DMARC failure with a p=reject policy can end the process here. With p=none, the failure is only recorded and passed on as one signal.
Layer 3: reputation
The provider looks up what it already knows about your sending domain and IP. This is the history covered in earlier chapters: complaint rates, bounce rates, spam trap hits, and past engagement. A strong history lets borderline messages through. A weak history makes the same message look worse.
Layer 4: content and link filters
The provider inspects the message itself. Typical checks include:
- URLs in the body, compared against lists of known bad domains
- Mismatches between visible link text and the real destination
- Attachment types
- Missing or broken HTML, or a message that is only one large image
These checks are supporting signals. A clean message from a bad sender still gets filtered, and a plain message from a good sender usually does not.
Layer 5: machine learning and engagement
Large providers train models on enormous volumes of mail and on user actions. The model takes many inputs: authentication results, reputation, content features, and how this specific recipient has treated mail from you before. It outputs a probability that the message is unwanted.
This is why the same message can reach one person's inbox and another person's spam folder. Per-recipient history, such as whether that user opens, replies to, or deletes your mail unread, feeds the model.
How the layers combine
Most layers add to a risk assessment instead of deciding alone. The table shows which layers usually act as hard gates and which act as signals.
| Layer | Typical role | Typical result of failure |
|---|---|---|
| Connection checks | Hard gate | Deferral or rejection during SMTP |
| Authentication | Gate or signal, depending on DMARC policy | Rejection or higher spam score |
| Blocklists | Gate or signal | Rejection or spam folder |
| Reputation | Signal with heavy weight | Spam folder or throttling |
| Content and links | Supporting signal | Small score change |
| Machine learning | Final combiner | Inbox or spam folder |
Common mistakes
- Debugging content first. If an SMTP reply shows a connection or blocklist rejection, rewriting the email will not help.
- Treating a pass on SPF, DKIM, and DMARC as a guarantee. Authentication proves identity, not that recipients want the mail.
- Ignoring 4xx deferrals. Repeated deferrals often mean the provider is throttling you because of reputation or volume.
Exercise
A message is rejected during the SMTP session with a 550 reply that cites a blocklist listing for your sending IP. Which layers of the stack could not have affected this outcome, and where should you start fixing it?
Show answer
Content and link filters and the machine learning model never ran, because the rejection happened before the message body was evaluated. Start with the blocklist: find out why the IP was listed (for example a complaint spike, spam trap hit, or compromised server), fix the cause, and then request delisting.