Greylisting is an anti-spam technique in which a receiving mail server temporarily rejects the first delivery attempt from an unfamiliar sender and accepts the same message only when the sending server retries after a delay. Within Email infrastructure on the Internet, it exploits a simple behavioral difference: legitimate mail transfer agents queue and retry deferred messages as SMTP requires, while many bulk spam tools fire once and move on.
The method was proposed in 2003 and spread quickly because it is cheap, needs no content analysis and blocks a large share of botnet traffic. Its main cost is delayed first-time delivery, which ranges from a few minutes to more than an hour depending on the sender’s retry schedule.
How greylisting uses SMTP temporary failures
Greylisting works by answering an unknown delivery with a 4xx temporary failure code, usually 451 4.7.1 Try again later, instead of accepting or permanently refusing it. RFC 5321 obliges a compliant sender to keep the message in its queue and try again, so genuine mail still arrives, only later.
The receiving server identifies each delivery attempt by a triplet: the IP address of the connecting client, the envelope sender from MAIL FROM and the envelope recipient from RCPT TO. The decision is made at the RCPT TO stage, before the message body is transferred, which keeps bandwidth and processing cost very low.
The following table shows the states a triplet passes through in a typical implementation.
| State | Trigger | Server response |
|---|---|---|
| New triplet | First attempt from an unseen combination | 451 temporary failure, record created |
| Blocked window | Retry before the minimum delay expires | 451 again, record unchanged |
| Passed | Retry after the minimum delay | 250 accepted, triplet whitelisted |
| Auto-whitelisted | Later mail from a known triplet or host | Accepted immediately |
| Expired | No retry within the retry window | Record deleted |
Timing parameters and their effects
The effectiveness and user impact of greylisting depend almost entirely on three timers. Administrators balance them to block one-shot senders without holding up real correspondence or bloating the triplet database.
| Parameter | Common range | What it controls |
|---|---|---|
| Minimum delay | 1 to 5 minutes | How soon a retry is accepted |
| Retry window | 4 to 48 hours | How long an unconfirmed triplet is kept |
| Whitelist lifetime | 30 to 60 days | How long a passed sender skips the check |
| Auto-whitelist threshold | 3 to 10 deliveries | When a whole client host is trusted |
A short minimum delay of one to five minutes is usually enough, because spamware rarely retries at all. Raising it to 15 or 30 minutes gains little filtering and noticeably delays legitimate mail, since large senders often space their retries at 15 minutes or more.
Real delay is set by the sender, not the receiver. Postfix and Exim commonly retry within 5 to 15 minutes, while some hosted platforms back off for 30 to 60 minutes, so the observed wait can exceed the configured minimum by a wide margin.
Greylisting compared with other filtering methods
Greylisting is a reputation-free, behavior-based filter, which sets it apart from content scanning and domain authentication. It is best treated as one layer among several rather than a replacement for a full spam filter.
| Method | What it checks | Main weakness |
|---|---|---|
| Greylisting | Whether the sender retries | Delays first contact |
| DNSBL lookup | Sending IP against public blocklists | False positives from listed shared IPs |
| SPF, DKIM and DMARC | Domain authorization and signatures | Spammers can authenticate their own domains |
| Content filtering | Message text, links and attachments | Higher CPU cost and tuning effort |
| Nolisting | Whether the sender tries a secondary MX | Breaks with careless DNS changes |
Nolisting is a close relative: a dead primary MX record forces a fallback to the working secondary host, which bots often skip. Both techniques rely on the same insight that compliant SMTP behavior is itself a signal of legitimacy.
Deploying greylisting in practice
Greylisting is normally implemented as a policy service consulted by the mail transfer agent. Postfix uses external daemons such as Postgrey through its policy delegation protocol, Exim can express the logic in its access control lists, and filtering suites such as Rspamd offer score-based greylisting applied only to doubtful messages.
A careful deployment reduces delay for known senders. The decision table below summarizes recommended settings for common situations.
| Situation | Recommended approach | Reason |
|---|---|---|
| Small business server | Greylist all unknown triplets | Cheap and highly effective against bots |
| Large provider pools | Match the client by /24 subnet | Retries often come from a different IP |
| Time-sensitive mail | Whitelist known senders | Avoids delayed codes and receipts |
| Modern filtering stack | Greylist only messages with medium scores | Limits delay to suspicious traffic |
| Backup MX host | Apply the same policy and shared data | Prevents bypass through the secondary |
Operators should also exempt authenticated submission on port 587 and internal relays, because greylisting is meant for inbound server-to-server traffic only.
Limitations, risks and common mistakes
The largest drawback is the unpredictable first-delivery delay, which hurts one-time passwords, password reset links and confirmation messages that expire within minutes. Users may request the code repeatedly and receive several at once later.
Effectiveness has also declined over time. Many botnets and spam services now retry, and spammers increasingly route through compromised accounts at major providers that behave like any compliant MTA, so greylisting alone stops a smaller share than it did in the mid-2000s.
- Large sender pools: retries from different IP addresses restart the timer and can delay mail for hours unless subnet matching or provider whitelists are used.
- Misbehaving legitimate senders: some older appliances and scripts treat a 4xx reply as permanent and never retry, causing silent message loss.
- Unsynchronized MX hosts: a secondary server without greylisting becomes an easy bypass path.
- Overlong delays: minimum delays above 15 minutes add user frustration with little extra filtering benefit.
A plain-language summary
Greylisting is like a doorkeeper who politely tells every unfamiliar visitor to come back in a few minutes. Real visitors with a genuine reason simply wait and knock again, so they get in. Many junk-mail machines never return, so their messages are never delivered.
Once a sender has passed the test, the doorkeeper remembers it and lets it straight in next time. The key trade-off is that the very first message from a new sender may arrive several minutes to an hour late.
An example from practice
A regional accounting firm runs its own Postfix server for 40 employees and receives roughly 6,000 inbound connection attempts per day, most of them spam from residential botnet addresses. The administrator enables a Postgrey policy service with a five-minute minimum delay, a 36-hour retry window and a 35-day whitelist lifetime, and adds subnet matching for large providers.
Within a week, the number of messages reaching the content filter falls by about two thirds, and CPU load on the server drops accordingly. Complaints arise only when clients receive verification codes from a tax portal, so the administrator whitelists that sending domain. The outcome is a much lighter spam load with only occasional delays for genuinely new correspondents.