Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

JavaMail giving "Domain contains illegal character null" when sending two email addresses

 
Bartender
Posts: 1803
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

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: "user@somedomain.com,other@domain.com"

(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 ``user@somedomain.com, other@domain.com''


Can anyone suggest what is going on and how to fix this issue?

Thanks very much,

-- mike

 
Sheriff
Posts: 22124
114
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mike London wrote:


I don't think that first argument is right there, is it?
 
Mike London
Bartender
Posts: 1803
17
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:

Mike London wrote:


I don't think that first argument is right there, is it?



Actually, I think that WAS the problem. Once I removed that line and replaced it with the correctly formatted "setFrom()" it worked!

Good eyes there.

Thank you so much, Rob!!!

(I would give you a 'cow' if my permissions allowed it. LOL)


-- mike
 
Marshal
Posts: 26493
81
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mike London wrote:(I would give you a 'cow' if my permissions allowed it. LOL)



Done for you.
 
Rob Spoor
Sheriff
Posts: 22124
114
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome, and thanks for the cow!
 
Alas, poor Yorick, he knew this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic