authenticating users against a table in postgres (or any
other database) ?
I know this is missing the DB part of your pie, but maybe someone else
will have some insight on that part. There are some resources off of http://www.qmail.org/.
I did see these, which is at least linking qmail and postgresql: