Problem with sending to multiple email recepient using JavaMail.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Friday, May 4, 2001 02:03 AM

Hi! I need help!!!! I'm writing a JavaMail servlet program that retreive email addresses from a database server and then, it will be use to send email msgs. The problem I'm having is that every time I send an email to multiple email recipients. It only sends out to one email address. Here's my code: -------------- html form --------------- ---------------------------------------- ------- sendMail servlet --------------- String[] toValues req.getParameterValue("to"); if(toValues!=null) { for(int i=0; i { String to_v = tovalues[i];    More>>

Hi!

I need help!!!!

I'm writing a JavaMail servlet program that retreive email addresses from a database server and then, it will be use to send email msgs.

The problem I'm having is that every time I send an email to multiple email recipients. It only sends out to one email address.

Here's my code:
-------------- html form ---------------












----------------------------------------

------- sendMail servlet ---------------

String[] toValues req.getParameterValue("to");

if(toValues!=null)
{
for(int i=0; i
{
String to_v = tovalues[i];

Address[] toAddresses =
InternetAddress.parse(to_v);

message.setRecipients(Message.RecipientType.TO,toAddresses);
}
}

message.setSubject(subject);
message.setText(text);

Transport.send(message);

----------------------------------------



Thanks in advance,
Alvin.    <<Less

Re: Problem with sending to multiple email recepient using JavaMail.

Posted By:   John_Zukowski  
Posted On:   Saturday, May 5, 2001 09:24 AM

Try using addRecipients instead of setRecipients. It looks like you are only adding one address each time and replacing the existing recipient, instead of adding an array of addresses.
About | Sitemap | Contact