Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can we attach multiple email addresses through spring email

 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we have an application that we need to send an email to multiple addresses from the to_address (splitting them with comma (,)), I can send single email, but i don't know how to send to multiple email addresses.

please give me simple suggestion
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi sumant,

why don't you post what you have so far?

Herman
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi herman,

Earlier I used to send to single email address successfully by the following code in Struts Action and Spring's Email delegate.

in Struts Action, I used to get the to, from, subject and body and I sent to email delegate

Struts Action:


Email delegate:


in Application Context file:


please see the above code and give me a possible solution.

here what I'm thinking is, we can multiple email addresses by seperating with comma, and in Struts action we will split them to each email address and I will send to each one in a for loop. is that make sense? if any alternative please advice me
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

look at Spring's javadoc:
SimpleMailMessage has 2 methods setTo. One that takes 1 String, and another that takes an array of Strings.

Hope this helps.

Herman
 
Simpson Kumar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Herman,
Excellent..! its working for multiple email to addresses.

I just took Stringtokenizer and i separated by comma and attached them to an array.

perfect..


thank you very much.. not even I checked documentation, its all my fault.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic