I have a requirement like this.

I have a program which sends out huge number of emails to customers using java API.

The code snippet is like below
Session session = Session.getDefaultInstance(properties, null);
MimeMessage msg = new MimeMessage(session);
msg.setRecipients(javax.mail.Message.RecipientType .TO, toAddress);
msg.setContent(emailContent, "text/html");

Here I am setting a custom header before sending a mail to the customer.
I am able to get/read this custom header field "user-id" by using pop3 protocol when a mail is sent to a valid email address.
However when the email was sent to an invalid email address the bounce back email doesn't have this custom header field "user-id".
I need this information because I have to update my database that the email address for this particular user-id has bounced.

Is there any thing we can do at the code level to read the custom headers? Or do we have to configure some thing at the mail server level to retain these custom headers in bounced back emails.
Please help me how to achieve this.

Thanks in advance