Create a special email address bounced@yourdomain.com , where you will display all bounced emails for analysis.
Add the following sent messages:
Return-Path: < bounced@yourdomain.com >
Letters will now return to this address.
From time to time, read letters to this address from your Java program, for example, through IMAP (or depending on your server through the notification interface / independently), and when you see the email address, write it to your database
Please note that if you are creating a newsletter application, you should not blacklist the e-mail the first time, but force it to be counted, and the black one after 3-4 bounces (some people set their e-mail to bounce when they go on vacation etc., so they need special care).
clyfe source share