This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 19649
    
  18

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: 41052
    
  43
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
 
Similar Threads
Send jsp page in mail as attachment
JavaMail API error
Javamail: Problem sending attachments
Email: java.lang.ClassFormatError
Exception trying to compile and run JavaMail App