duplicate mail

Hi all,

I use JavaMail API to send an email, but each time I call the send mail class I define. It sends the message 2 times for each call.

I wonder if it's mail server's problem or there is something wrong in my code? I pass in a vector email address to that send mail class, would that be a problem?

import java.util.*;

import javax.mail.*;

import javax.mail.internet.*;

publicclass EmailHandler{

public EmailHandler ( String host, String from, Vector to, String subject, String content ){

try{

Properties props = System.getProperties();

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

Session session = Session.getDefaultInstance(props,null);

MimeMessage message =new MimeMessage(session);

message.setFrom(new InternetAddress(from));

// a list of email in vector

for ( Enumerationenum = to.elements() ; enum.hasMoreElements(); ){

message.addRecipient(Message.RecipientType.TO,new InternetAddress(address));

}

message.setSubject(subject);

message.setText(content);

Transport.send(message);

}catch ( Exception e ){

System.out.println( e.toString() );

}

}

[1992 byte] By [ulukb00] at [2007-9-26 1:33:26]
# 1
P.S.the mail server I use is MS exchange sever.thanks.
ulukb00 at 2007-6-29 1:35:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...