how to send message to mailing list with apache commons?

I am working on an application to send emails with javafx and apache mail commons, but it throws and error when i try to send the message.

Caused by: javax.mail.internet.AddressException: Illegal address in

string `` ''

at javax.mail.internet.InternetAddress.(InternetAddress.java:122)

at org.apache.commons.mail.Email.createInternetAddress(Email.java:1949)

... 59 more

Anyways i noticed when i initialize the array of strings with my recipients it sends it correctly, but if i take them from the database it throws the error i wrote above.

The way it works.

HtmlEmail email = new HtmlEmail();

...

String[] emails = {"email1@domain.com", "email2@domain.com"}

email.addTo(emails);

The way it doesn't work

HtmlEmail email = new HtmlEmail();

...

String[] emails...

Read More »

By: StackOverFlow - Tuesday, 13 March

Related Posts