Sir ,i want to send mail to different mail ids at a time ....
But problem in my code ,when i am sending mail to different persons ,it is sending repeatedly 3 times ,the same mail for the same persons ...

i am not getting where the problem is
my code
Send.jsp
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Email Example</title>
<style type="text/css">
<!--
body {
	background-image: url();
}
.style2 {	font-size: 36px;
	color: #33FF66;
}
.style4 {color: #0000FF}
.style5 {
	font-size: medium;
	color: #009966;
}
.style6 {color: #FF0000}
-->
</style>
 
<script type="text/javascript" language="javascript">
function valid()
{
if(document.form1.to.value=="")
{
alert("Email  can't blank...");
document.form1.to.focus();
  document.form1.to.style.backgroundColor = "#FF9966";
	  document.form1.to.select();
return false;
}
if(document.form1.subject.value=="")
{
alert("Subject can't blank...");
document.form1.subject.focus();
  document.form1.subject.style.backgroundColor = "#FF9966";
	  document.form1.subject.select();
return false;
}
if(document.form1.body.value=="")
{
alert("Message can't blank...");
document.form1.body.focus();
  document.form1.body.style.backgroundColor = "#FF9966";
	  document.form1.body.select();
return false;
}
return true;
}
</script>
</head>
 
<body>
<table width="100%" height="100%" border="0" align="center">
  <tr>
 
    <th width="100%" scope="col"><table width="100%" height="100%"  border="0">
      <tr>
        <td height="107"><div align="center"><span class="style2"> <span class="style4"> Welcome to Email send example </span> </span></div></td>
        </tr>
 
    </table>    </th>
  </tr>
  <tr>
    <th scope="col">&nbsp;</th>
  </tr>
  <tr>
    <th scope="col">&nbsp;</th>
  </tr>
  <tr>
    <th scope="col"><table width="501" height="282" border="0" align="center">
      <form  name="form1" method="post" action="EmailsendProcess.jsp" onsubmit="return valid()">
        <tr>
          <th colspan="3" scope="col"><label><span class="style5">If you have any suggestion, query, questions,or if you would like to   contact me for a quote, please use the form below and we will get back   to you as soon as possible.</span></label></th>
          </tr>
        <tr>
          <th width="79" scope="col"><div align="right">Email:<span class="style6">*</span></div></th>
          <th colspan="2" scope="col"><div align="left">
            <label>
            <input name="to" type="email" size="50%" required="required" multiple="multiple"/>
            </label>
          </div></th>
        </tr>
        <tr>
          <th scope="row"><div align="right">Subject:<span class="style6">*</span></div></th>
          <td colspan="2"><label></label>
              <div align="left">
                <label>
                <input name="subject" type="text" size="50%" required="required"/>
                </label>
            </div></td>
        </tr>
        <tr>
          <th height="127" scope="row"><div align="right">Message:<span class="style6">*</span></div></th>
          <td colspan="2"><div align="left">
              <textarea name="body" cols="50%" wrap="off" required="required" ></textarea>
          </div></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td width="107"><input type="submit" name="Submit" value="Submit" /></td>
          <td width="301"><input type="reset" name="Submit2" value="Reset" /></td>
        </tr>
      </form>
    </table></th>
  </tr>
  <tbody>
  </tbody>
  <tbody>
  </tbody>
</table>
</body>
</html>

EmailsendProcess.jsp
<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Email send Example for project </title>
</head>
<body>
<%@ page import="java.util.*" %>
<%@ page import="javax.mail.*" %>
<%@ page import="javax.mail.internet.*" %>
<%@ page import="javax.activation.*" %>
<%@ page import="javax.net.ssl.*" %>
<%@ page import="java.lang.String.*" %>
<%
try
               {
String host = "smtp.gmail.com";
 
String to= request.getParameter("to");
String to1[]= request.getParameterValues("to");
String[] parts = to.split(",");
//String[] result =to1[].split(",");
String part1[] = parts;
//out.println("I am first String" +part1);
//for(int j=0;j<=part1.length;j++){
//out.println("\n I am first String1" +part1[0]);
//out.println("\n I am first String2" +part1[1]);
//out.println("\n I am first String" +part1[j]);
String from="from address";  // write your email address means from email address.
String subject = request.getParameter("subject");
String messageText = request.getParameter("body");
boolean sessionDebug = true;
// Create some properties and get the default Session.
//System.setProperty("smtp.protocols", "SSLv3");
Properties props = System.getProperties();
 
props.put("mail.smtp.starttls.enable","true");
props.setProperty("mail.transport.protocol","smtp");
props.setProperty("mail.host",host);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.port", "465");    //port is 587 for TLS  if you use SSL then port is 465
props.put("mail.debug", "true");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
 
Session mailSession = Session.getInstance(props, new javax.mail.Authenticator() {protected PasswordAuthentication getPasswordAuthentication() {return new PasswordAuthentication("email address of sender", "password");
}
});
 
// Set debug on the Session
// Passing false will not echo debug info, and passing True will.
 
mailSession.setDebug(sessionDebug);
 
// Instantiate a new MimeMessage and fill it with the
// required information.
 
Message msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(from));
 
for(int i=0;i<part1.length;i++){
InternetAddress[] address = {new InternetAddress(part1[i])};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
msg.setSentDate(new Date());
msg.setText(messageText);
 
// Hand the message to the default transport service
// for delivery.
 
 Transport transport = mailSession.getTransport("smtp");
transport.connect(host, "emiladdress of sender", "password");
transport.sendMessage(msg, msg.getAllRecipients());
transport.send(msg);
out.println("Mail was sent to " +part1[i]);
out.println(part1[i]);
out.println(" from "+from);
out.println(" using host "+host+".");
 
}
}
 
catch(Exception e)
 
                    {
    out.println(""+e);
          }
%>
</table>
</body>
</html>

can anybody help me?