Catching successfull/failed deliveries

Tomas Simonaitis <[email protected]> Thu, 16 Dec 2004 23:19:07 +0200
Newsgroups gmane.mail.exim.exiscan.user
Message-ID <[email protected]>
I would like to log all successfull/failed deliveries to db by sender ip and 
use it later for accept/drop decisions.
Querying and dropping message seems straightforward (unless I'm missing 
something).
How could I execute query/external program on both accepts and rejects?
{I could periodically scan logs and update db, but would rather not.}