Question

We have a module which will send reminder mail. We are using apache commons email library for sending mail. We have no issue if we send mail only one email address using addTo method of HtmlEmail, but we are encountering exception when we are trying to send the same mail to more than a user using setTo which accepts Collection.
Even commons mail javadoc mentioned that this method is to send mail to a group of email address but surprisingly its not working.
Is there any workaround to solve this problem or hint to proceed with right direction?

Was it helpful?

Solution

Did you make sure, that your Collection contains only objects of the expected Type? Exerpt from the JavaDoc for setTo(java.util.Collection):

Set a list of "TO" addresses. All elements in the specified Collection are expected to be of type java.mail.internet.InternetAddress.

Providing source code or exceptions for your problem would make it easier to help you to find the solution to your problem.

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