Although this code seems to work fine standalone, when I use it in Tomcat from a service with two email addresses, I get this error: "Domain contains illegal character null"
For example, the "TO" might contain: "email@example.com,firstname.lastname@example.org"
(A single address works!).
Now, stepping through the code, I indeed get the correct "TO" POSTed to the service (both email addresses), but on the Transport.send(), I get this nasty "Domain contains illegal character null" error. Looking at the debug output, when the code crashes on Transport.send(), it says:
javax.mail.internet.AddressException: Domain contains illegal character in string ``email@example.com, firstname.lastname@example.org''
Can anyone suggest what is going on and how to fix this issue?