[ad#within-post] I have spent quite some time working on the definitive qmail patch. So as not to keep all this goodness to my self I have decided to make this patch available to all:

http://thegrebs.com/~michael/netqmail-1.06.patch.bz2