Using Apache Commons to send email contains the following code.
HtmlEmail email = new HtmlEmail(); email.setHostName(SMTP_HOST_NAME); email.setSmtpPort(587); email.setAuthenticator(new DefaultAuthenticator(SMTP_AUTH_USER, SMTP_AUTH_PWD)); email.setTLS(true); email.setBounceAddress(" aaa@abc.com "); email.setMsg("Hello"); email.setFrom(" bbb@abc.edu "); email.addReplyTo(" bbb@abc.edu "); email.addTo(" i.do.not.exist@abc.gmail.com "); email.send();
But the rebound will not work. It sends failures to the party that authenticated the message, which in this example is SMTP_AUTH_USER. So how can I make it bounce correctly?
source share