Is there any way to detect bounced emails so as to delete those enries from the database??
If you need to detect all bounced emails originating from your server, then the short answer is no, at least not in a way which can be 100% guarenteed.
The big issue with this is SMTP (by "email", I'm assuming you mean this protocol? ) doesn't define any uniform way to describe a delivery failure. There is another "standard" - a MIME type for reporting mail admin messages (see here if you are interested) - but it is not widely implemented. So there is not absolute guarentee that a delivery failure will result in a failure report, or that any failure report generated will be returned to the sending server. Even if it does, it may be of a type whereby you can't match a sent email with a particular delivery failure.