A genuine mail server that receives a temporary error retries a few minutes later, whereas a crude bulk-mailing tool usually does not. Greylisting exploits this difference: the first message from an unfamiliar sender is rejected with a 4xx code, and the retry is accepted.
How it works
- A message arrives from a sender the server has not seen before.
- The server records details of the sender and replies with a temporary rejection (under RFC 6647, a
421reply that closes the connection, or another4yzreply). - A legitimate MTA queues the message and tries again.
- The retry arrives after the minimum delay; the server accepts the message and remembers the sender.
Which details are recorded depends on the implementation: in the simplest case only the client’s IP address, in more elaborate ones the IP address, sender and recipient. Rspamd stores two hashes per message in Redis, one for the envelope and one for the content, and masks the IP address to /19 for IPv4 and /64 for IPv6.
| Rspamd parameter | Default | Meaning |
|---|---|---|
timeout | 5 minutes | how long a message is rejected after the first attempt |
expire | 1 day | how long the sender’s record is kept |
The cost
The first message to a new correspondent arrives at least five minutes late, and if the record is tied to the IP address, a retry from a different address counts as a new message and is rejected again. By default Rspamd delays only messages whose score has already exceeded the greylist action threshold. RFC 6647 (2012) calls greylisting an established anti-spam technique, but notes that some bulk-mailing tools do retry.
Sources
the term is written from these pagesVerified 9 Nov