Infomation about Greylisting
Look at http://projects.puremagic.com/greylisting/
for information about greylisting as well as an implementation for sendmail written in perl.
Instructions for Qmail
I can't help you too much with this since I don't use qmail. My software builds a stand alone program called qmail-envelope-scanner that implements greylisting. Its easy to build the program; just unpack the tar file and type "make". Then you need to patch qmail to call this program. Included in the tar file is a dbdef.sql file that will create the required mysql database.
Instructions for setting up Exim for greylisting
1. Use the dbdef.sql sql file to create the required mysql database.
2. Replace the local_scan.c file that comes with exim with the version in the exim tar file you downloaded from this page. I'm
using exim 4.23 and also previously used it with exim 4.20 but it should be pretty portable to other exim versions as
long at the major is 4.xx. (If you use my Makefile, the local_scan.c file should go in the "Local" directory not the exim "src" directory.)
3. Add -lmysqlclient to exims makefile to link in the required library or you can optionally use my Makefile which is included in the tar file. Using my Makefile is not required and probably not advised unless you also have exim version 4.20 and have looked through my Makefile first
5. make install
The code here should faithfully implement the Evan Harris' greylist specification. It was done completely from scratch since "C"/Exim are so different that the implementation he did for Perl/Sendmail. Its always possible that I didn't understand something or even have a bug. Update
The code has been stable now for about one year and hundreds of downloads with many positive reports
If mysql isn't running, the relaydelay database doesn't exist or the username
or password fails, greylisting will be disabled and messages will be accepted
according to exims standard rules.
I have temporarily hard coded 55 minutes, 8+hours and 36 days for the time values. Exim provides a method to configure this from the main exim config file or I might also use a separate config file. Temporarily
no config file is needed.
The greylist version of exim attaches to the mysql server on the local
machine. While I agree all mailservers sharing a common database is
important, the whole purpose of having redundant mailservers is defeated if
all use the same database. Using local databases with replication or some
other sync process seems better. No single point of failure (like a single
mysql database) should be able to take down all mailservers.
While some patched versions of exim support dynamically loaded local_scan
functions, the standard exim requires it to be compiled in. Just replace the
default local_scan.c file with the attached version and add the mysqlclient
library to the Makefile and then "make" and "make install"
If you want to download the exim source, its available at: http://www.exim.org. If you want the patches to build an exim with a dynamically loaded local_scan or with spamassassin compiled in for smtp time checks see http://dman.ddts.net/~dman/software/exim/ Caution: his site seems semi-available.
Another way to do greylisting with exim is http://noc.polesye.net/greylist/.