3 Replies Latest reply on Jun 8, 2014 11:16 PM by jaikiran pai

    Wildfly 8.1.0 Final Mail-Session always uses localhost

    Tomas Kainbacher Newbie

      I’m trying to setup some simple mail service on Wildfly 8.1 with Gmail(for testing).

      For some reason, every time I transport the Mail, Wildfly tries to connect to localhost instead of the assigned outbound-socket!

       

      2014-06-07 13:59:01,353 ERROR [stderr] (default task-4) com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;

      2014-06-07 13:59:01,353 ERROR [stderr] (default task-4)   nested exception is:

      2014-06-07 13:59:01,353 ERROR [stderr] (default task-4)     java.net.ConnectException: Connection refused: connect

      2014-06-07 13:59:01,354 ERROR [stderr] (default task-4)     at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1984)

      2014-06-07 13:59:01,354 ERROR [stderr] (default task-4)     at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:656)

      2014-06-07 13:59:01,354 ERROR [stderr] (default task-4)     at javax.mail.Service.connect(Service.java:345)

      2014-06-07 13:59:01,354 ERROR [stderr] (default task-4)     at javax.mail.Service.connect(Service.java:226)

      2014-06-07 13:59:01,354 ERROR [stderr] (default task-4)     at javax.mail.Service.connect(Service.java:175)

      2014-06-07 13:59:01,354 ERROR [stderr] (default task-4)     at javax.mail.Transport.send0(Transport.java:253)

      2014-06-07 13:59:01,354 ERROR [stderr] (default task-4)     at javax.mail.Transport.send(Transport.java:124)

       

      In standalone.xml:
      ...
      <mail-session name="java:jboss/mail/gmail" debug="true" jndi-name="java:jboss/mail/gmail">
        
      <smtp-server outbound-socket-binding-ref="mail-smtp" ssl="true" username="user@gmail.com" password="pass"/>
      </mail-session>
      ...
      <outbound-socket-binding name="mail-smtp">
        
      <remote-destination host="smtp.gmail.com" port="465"/>
      </outbound-socket-binding>

       

      As soon as I try to transport a mail I get the error!!
      What am I missing that it tries to connect to localhost?