There are a wide variety of techniques for blocking spam. One popular method is to use greylisting. Greylisting is a technique that relies on the fact that many spammers use 'bots' (automated processes) to send email directly to email servers. These bots rarely retry to send email in the event of any errors. Greylisting takes advantage of this by temporarily failing all connections from new senders. Spam bots will not retry, but all legitimate mailservers will as per the SMTP specification.
Greylisting typically relies on identifying a sender and recipient pair by using a 'triplet'. This consists of three pieces of information:
The advantage of greylisting is that it has a very low false positive rate. That is, it is unlikely to block legitimate email. The disadvantage is that email from a new sender is delayed for a period of time equal to the retry interval of the sending server. This can result in typical delays of 10 to 15 minutes but can be up to one or two hours in extreme cases. Once the sender has been accepted though, email from that sender is in future instantaneous.
Lets work through an example.
A bot attempts to send an email from firstname.lastname@example.org to email@example.com from IP address 22.214.171.124
|Mail from bot||Rejects||Mailserver|
The email is rejected with a temporary error code of 420. The bot does not retry as it simply tries the next server or recipient in its list of people to spam. The spam is effectively blocked.
In the second case, a mailserver attempts to send email from firstname.lastname@example.org to email@example.com from IP address 126.96.36.199
|Remote mailserver||Rejects||Local Mailserver|
Initially the email is rejected as its from a new triplet. The sending mailserver is well-behaved and retries:
|Remote mailserver||Retry Accepted||Local Mailserver|
The retry is accepted as the receiving mailserver has remembered the triplet and immediately accepts the email. Note that other spam blocking techniques may also be applied after greylisting to ensure that spam email sent from servers or bots that do retry is also eliminated.
If you wish to add Greylisting to any email server you can use Hexamail Guard or Hexamail Nexus. They provide a sophisticated array of greylisting features in addition to many other spam blocking techniques. Hexamail greylisting has several advantages over many other greylisting implementations:
Hexamail also provide a mailserver with built in antispam and greylisting capabilities Hexamail Server.