How to count bounced email against email address and update my email database


I just setup an email server using Mail IN Box which I will be using for my marketing campaign. So there could be some emails which are bounced and I want to update my email list with a flag=bounced.

How can I extract this info from the mail server? Is there any REST API or can I make query to the email sent or bounce database?

Thanks in advance for any one who can suggest me a better solution!

I don’t know much about miab internals so, if I had to get this working with no research, I would set up a rule in RoundCube to route all the bounces to a specific folder, then interrogate that folder using Python (imaplib), extract the email addresses and update my database accordingly.