Question

We're using JavaMail API to send emails from our application. To handle bounce back messages (Non delivery report), we're redirecting bounce backs to a different email address using the following code:

properties.put("mail.smtp.from", "bounce@example.net");

In our case, we want bounce backs to be redirected to multiple email addresses. In fact, we even tried few other options like providing a list of addresses separated by commas, etc., but none of them are working.

My question here is, is it possible to redirect bounce backs to multiple email addresses? I'm not able to find the right answer/solution even after googling.

Any alternative/workaround solution are also appreciated.

Was it helpful?

Solution

Since by definition/RFC the SMTP protocol allows only one address in "MAIL FROM:" Stage (which is the bounce address), the only way of having bounces sent to multiple recipients would be a forwarder from a single bounce address to multiple target adresses.

however, all bounces by would come from the null sender, so you wouln't get any notification if that forwarding fails for any reaseon, it would create a "double-bounce", and the messages would be deleted.

Therefore, I recommend storing the bounces in an imap folder and give all required people or applications access to that (eg. polling the bounces instead of forwarding), if that is feasible in your environment.

OTHER TIPS

Apache Commons Email allows bounce off. But unfortunately it takes single String and does not allow Collection of InternetAddress.
HtmlEmail email = new HtmlEmail(); email.setBounceAddress("bounceoff-emailad@abc.com");
Hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top