title: javax.mail.MessagingException: Could not connect to SMTP host: mail.tranzlease.com, port: 465, response: -1
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/8593303/could-not-connect-to-smtp-host-email-smtp-us-east-1-amazonaws-com-port-465-r">Could not connect to SMTP host: email-smtp.us-east-1.amazonaws.com, port: 465, response: -1</a>  </p>
  </blockquote>
  
  
  
  <p>My application shows this error when I try to send mail through Lotus Domino server using JavaMail API with my company's mail ID:</p>
  
  <p><code>javax.mail.MessagingException: Could not connect to SMTP host: mail.tranzlease.com, port: 465, response: -</code>1</p>
  
  <p>I am able to send the mail through my Gmail ID.</p>
  
  <pre><code>public void sendtoGroup(String sub,String msg) {
    try {
      String host = "mail.myweb.com";
      String from = "vinod.patil@myweb.com";
      String pass = "12345";
      Properties props = System.getProperties();
      props.put("mail.smtp.starttls.enable", "false"); // added this line
      props.put("mail.smtp.host", host);
      props.put("mail.smtp.user", from);
      props.put("mail.smtp.password", pass);
      props.put("mail.smtp.port", "465");
      props.put("mail.smtp.auth", "true");
  
      String[] to = {"vinod.patil@myweb.com","vinodpatil76@rediffmail.com"}; 
      Session session = Session.getDefaultInstance(props, null);
      MimeMessage message = new MimeMessage(session);
      message.setFrom(new InternetAddress(from));
  
      InternetAddress[] toAddress = new InternetAddress[to.length];
  
      // To get the array of addresses
      for( int i=0; i &lt; to.length; i++ ) { // changed from a while loop
          toAddress[i] = new InternetAddress(to[i]);
      }
      System.out.println(Message.RecipientType.TO);
  
      for( int i=0; i &lt; toAddress.length; i++) { 
          message.addRecipient(Message.RecipientType.TO, toAddress[i]);
      }
      message.setSubject(sub);
      message.setText(msg);
      Transport transport = session.getTransport("smtp");
      transport.connect(host, from, pass);
      transport.sendMessage(message, message.getAllRecipients());
      transport.close();
    } catch(Exception e) {
      e.printStackTrace();
      }
    }
  }
  </code></pre>