PHP-Programs - PHP mailer - handling undelivered emails / bad addresses

I have apache server and php-mailer that sends mails to addresses that it picks up from a MySQL database. What I’m trying to do, is that if some mail is returned as undelivered that address in database is invalid, so it should be marked as ‘offline’. So the mailer wouldn’t send any new messages to that address. Before I can do this I need to know if some email(s) are returned as undelivered.

How could I get information about undelivered mails? With ‘reply to’ and ‘return path’ in the headers?

And how could I automaticly update thease bad addresses to offline in mysql database? In other words, which is the best way to handle all undelivered mails?