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.
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
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
Joined: Jul 17, 2006
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.
Joined: Mar 19, 2008
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.
thank you very much.. not even I checked documentation, its all my fault.
subject: Can we attach multiple email addresses through spring email