title: Javamail, Transport.send() very slow
body: <p>I have written a method for sending emails in bulk but it is very very slow (around 3 mails every 10 seconds). I want to send thousands of mails. Is there any way to do this much more faster?</p>
  
  <p>I am using gmail now but only for test, finally I want to send using my own SMTP server.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>public boolean sendMessages()
  {
      try 
      {
          Session session = Session.getInstance(this._properties, new javax.mail.Authenticator() {
              @Override
              protected PasswordAuthentication getPasswordAuthentication() {
                   return new PasswordAuthentication("user", "password");
              }
          });
          MimeMessage message = new MimeMessage(session);
          message.setFrom(new InternetAddress(this.getFrom()));
  
  
          message.setSubject(this.getSubject());
          message.setText(this.getBody());                
          for (int i = 0, c = this._addresses.size(); i &lt; c; i++)
          {
              message.setRecipient(Message.RecipientType.TO,  new InternetAddress(this._addresses.get(i)));                    
              Transport.send(message);
          }
          return true;
       } 
       catch(AuthenticationFailedException e) {
           e.printStackTrace();
             return false;
       }
       catch(MessagingException e) {
           e.printStackTrace();
             return false;
       }
  }
  </code></pre>