If you use
VERPs, you'll be able to determine where the bounce came from by who the bounce is sent to, which is much easier than trying to parse bounce messages. You can catch the bounces in a
.forward file which runs a program to remove them from the database.
qmail has good support for VERPs, and it's easy to hack it together with Perl for other MTAs.