title: apache SimpleEmail on Wildfly 9: Connection exception; on Wildfly 8 works perfectly
body: <p>I used SimpleEmail from org.apache.commons.mail.SimpleEmail successful in Wildfly 8. Now, I migrated to Wildfy 9 and SimpleEmail does every time raise a connection exception.</p>
  
  <p>The exception is thrown on <code>email.send()</code> in the code below:</p>
  
  <pre><code>try
  {
      Email email = new SimpleEmail();
      email.setHostName("mail.gmx.net");
      email.setAuthenticator(new DefaultAuthenticator("sender@gmx.ch", "password"));
      email.setSSLOnConnect(true);
      email.setFrom("sender@gmx.ch");
      email.setCharset(org.apache.commons.mail.EmailConstants.UTF_8);
      email.setSubject("TestMail");
      email.setMsg("This is a test mail ... :-)");
      email.addTo("receiver@gmx.ch");
      email.send();
  
  }
  </code></pre>
  
  <p>Exception trace:</p>
  
  <pre><code>org.apache.commons.mail.EmailException: Sending the email to the following server failed : mail.gmx.net:465
      at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
      at org.apache.commons.mail.Email.send(Email.java:1448)
      ...
  
  Caused by: javax.mail.MessagingException: Could not connect to SMTP host: mail.gmx.net, port: 465, response: -1
      at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2042)
      at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:697)
      at javax.mail.Service.connect(Service.java:386)
      at javax.mail.Service.connect(Service.java:245)
      at javax.mail.Service.connect(Service.java:194)
      at javax.mail.Transport.send0(Transport.java:253)
      at javax.mail.Transport.send(Transport.java:124)
      at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
      ... 53 more
  </code></pre>
  
  <p>Does anybody know where I need to search for the problem?</p>