É só eu ou todo mundo tem problema para enviar emails?

Ola pessoal, no meu projeto enviar email é muito importante, e classe de envio de email não funciona direito.
Dá o Exception endereço invalido mas já alterei o email e dá o mesmo problema,
já fiz com email da locaweb e da webhost.

[code]public static void sendSimpleMail ( String subject, ArrayList to, String mensagem , String usuarioEmail) throws AddressException {

   String mailServer = "mail.orga.com.br";
   String from = "sistema@orga.com.br";
   
   if(to.size() > 0){
       try{  
           Properties props = new Properties(); 
           
           props.put("mail.smtp.host", mailServer);  
           props.put("mail.smtp.auth", "true");
           Authenticator auth = new SMTPAuthenticator();  
           Session session = Session.getDefaultInstance(props, auth);  
           session.setDebug(false);  
           Message msg = new MimeMessage(session);  
     
           InternetAddress addressFrom = new InternetAddress(from);  
           msg.setFrom(addressFrom);  
           //Email com apenas Um Endereço(Recipient)
           //InternetAddress addressTo = new InternetAddress(to);  
           //msg.setRecipient(Message.RecipientType.TO, addressTo);  
           
           //Email com Varios Endereços(Recipients)
           InternetAddress[] addressTo = new InternetAddress[to.size()];
           for (int i = 0; i < to.size(); i++) {
                addressTo[i] = new InternetAddress(to.get(i));
            }
           InternetAddress[] addressUser = new InternetAddress[0];
           addressUser[0] = new InternetAddress(usuarioEmail);
           
           msg.setRecipients(Message.RecipientType.TO, addressTo);
           msg.setSubject(subject);  
          // msg.setReplyTo(addressUser);
           msg.setContent(mensagem, "text/html");  
           
           Transport.send(msg); 
           
                          
       }catch(Exception ex ){ 
           //JOptionPane.showMessageDialog(null, ex.getMessage());
           //JOptionPane.showMessageDialog(null, "ERRO");  
       }  
   }  
}
public static class SMTPAuthenticator extends javax.mail.Authenticator{  
    @Override
       public PasswordAuthentication getPasswordAuthentication(){  
          return new PasswordAuthentication("sistema@orga.com.br", "xxxxx");
       }  
}[/code]

Se alguem puder me ajudar, eu estou precisando bastante não sei mas o que fazer.
Abraços.

Ja pensou em usar apache commons mail? http://commons.apache.org/email/

Vc vai economizar 2839283 linhas de codigo. :slight_smile:

//Daniel

Valeu pela dica ai,
arrumei meu código com commons e não deu mais problema.

Abraço