title: Javamail doesn't send a mail
body: <p>I am developing a Java application and I am using Javamail to send a mail. My code is the following:</p>
  
  <pre><code>Properties props = new Properties();
  props.put("mail.smtp.host", "diana.cartif.es");
  props.put("mail.smtp.socketFactory.port", "465");
  props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
  props.put("mail.smtp.auth", "true");
  props.put("mail.smtp.port", "465");
  
  Session session = Session.getDefaultInstance(props,
      new javax.mail.Authenticator() {
          protected PasswordAuthentication getPasswordAuthentication() {
              return new PasswordAuthentication("alerts","pass");
          }
      });
  
  Message message = new MimeMessage(session);
  message.setFrom(new InternetAddress("alerts@cartif.es"));
  message.setRecipients(Message.RecipientType.TO,InternetAddress.parse("campus21@cartif.es"));
  message.setSubject("Testing Subject");
  message.setText("Dear Mail Crawler," +"\n\n No spam to my email, please!");
  
  Transport.send(message);
  </code></pre>
  
  <p>However when I execute this code it throws an Exception:</p>
  
  <pre><code>javax.mail.MessagingException: Could not connect to SMTP host: diana.cartif.es, port: 465, response: -1
      at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1960)
      at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
      at javax.mail.Service.connect(Service.java:317)
      at javax.mail.Service.connect(Service.java:176)
      at javax.mail.Service.connect(Service.java:125)
      at javax.mail.Transport.send0(Transport.java:194)
      at javax.mail.Transport.send(Transport.java:124)
      at com.cartif.data.MainConnection.getFTPConnection(MainConnection.java:106)
      at com.cartif.main.Main.connectToServer(Main.java:72)
      at com.cartif.main.Main.main(Main.java:60)
  </code></pre>
  
  <p>Data to connect is right because I checked it in my Mail Server. Could someone help me please?</p>
  
  <p>Thanks!</p>