jQuery in Action, 2nd edition*
The moose likes Other JSE/JEE APIs and the fly likes How to send mail to more than one recipients Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "How to send mail to more than one recipients" Watch "How to send mail to more than one recipients" New topic
Author

How to send mail to more than one recipients

pallavi chaudhari
Ranch Hand

Joined: Jul 02, 2008
Posts: 54

how to send mail to more than one receipients??
I am giving my code,



This code works fine for only single mail receipient......how to send mail to more than one receipients?? What changes i nedd to do in sendMail() method?
please help....its urgent..........
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19723
    
  20

You're already calling "message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));". How about using that to add more recipients?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
pallavi chaudhari
Ranch Hand

Joined: Jul 02, 2008
Posts: 54
Rob Prime wrote:You're already calling "message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));". How about using that to add more recipients?


so,by using addRecipients() method how can i do? please tell
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
You can use message.setRecipients(Message.RecipientType.TO, addressTo); where addressTo is array of type InternetAddress.


SCJP 1.5(97%) My Blog
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42355
    
  64
pallavi chaudhari wrote:so,by using addRecipients() method how can i do? please tell

The javadocs of the addRecipient and addRecipients methods are pretty clear on what they do, are they not?


Ping & DNS - my free Android networking tools app
 
 
subject: How to send mail to more than one recipients