Just to give you something to do. Similar to what adkorte et al have suggested [url]http://phorum5.greennet.org.uk/read.php?22,1434[/url] :
1) when doing the reverse DNS, leave at least a top level and a second level domain. One strategy might be to count the dots in order to split it in the middle, i.e if a rDNS entry has 2 or 3 parts, leave 2. If it has 4 or 5, leave 3.
2) given there can be multiple PTR records, find some way of standardising this, perhaps using a DNS library to return all, and take the first alphabetically, instead of getnamebyaddr().
3) to minimise delays from "new" and "wait", there could be an option to send outgoing mail through gps in such a way as to insert a triplet in preparation for a possible reply, i.e. a local user send to a remote address at a given MX, enter a triplet for the local user's address as recipient and the remote address as sender. It won't catch all replies, but should help.
4) allow not just a single range for timeout (0-a], when SMTP connections get a "wait" 450, but allow (a-b], (c-d] etc. This is because those spamming programs which do get around greylisting can be quite predictable.