How did you enter the multiple addresses?  Most SMTP servers will accept
multiple names with a comma and no space in between them.

-----Original Message-----
From: Sivakumar Chiluvuri [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 01, 2001 12:03 AM
To: [EMAIL PROTECTED]
Subject: Java Mail in JSP - Problem with multiple addresses


Hi all

the following jsp is working fine with single mail address, but when we
enter
multiple address it failed

how to pass array of address

pl. help

thanks

regards
 siva kumar

code :

<%@ page
  import=" javax.mail.*, javax.mail.internet.*, javax.activation.*,
java.util.*"
  %>
<html>
<head>
<TITLE>JavaMail</TITLE>
</HEAD>
<BODY>
<%

 try{
   Properties props = new Properties();
   Session sendMailSession;
   Store store;
   Transport transport;

  sendMailSession = Session.getInstance(props, null);

  props.put("mail.smtp.host", "mail.webappcabaret.com");

  Message newMessage = new MimeMessage(sendMailSession);
  newMessage.setFrom(new InternetAddress(request.getParameter("from")));

 // String to = request.getParameter("to");
  // InternetAddress [] address = {new InternetAddress(to)};      this is
not
working

  newMessage.setRecipient(Message.RecipientType.TO, new
InternetAddress(request.getParameter("to")));
  newMessage.setSubject(request.getParameter("subject"));
  newMessage.setSentDate(new Date());
  newMessage.setText(request.getParameter("text"));

  transport = sendMailSession.getTransport("smtp");
  transport.send(newMessage);
   %>
<P><B><H3>Your mail has been sent to the following persons:  <%
out.println(request.getParameter("to")); %></H3></B></P>
<%
  }
 catch(MessagingException m)
  {
  out.println(m.toString());
  }
%>
</BODY>
</HTML>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to