Search code examples
emailsmtpwildfly-swarm

How to configure outbound-socket-binding for SMTP mail in wildfly swarm for using yaml?


I am porting an application from Wildfly 10.0.1.0 to Wildly Swarm 2017.7.0.

Everything went rather smoothly except for the SMTP e-mail configuration using YAML:

I tried some alternatives, but here is the latest one based on what I think the yaml would be from standalone.xml mapping - project-defaults.yml

swarm:
  socket-binding-groups:
    mail-socket:    
      outbound-socket-bindings:
        mail-smtp:
          remote-host: smtp.someprovider.com
          remote-port: 587

  mail:
    mail-sessions:
      smtpSession:
        jndi-name: java:/smtpSession
        smtp-server:
          username: username_here
          password: password_here
          tls: true
          outbound-socket-binding-ref: mail-smtp

However I still get error:

2017-08-05 11:17:36,100 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "mail"),
("mail-session" => "smtpSession") 
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.outbound-socket-binding.mail-smtp"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.mail-session.smtpSession is missing [jboss.outbound-socket-binding.mail-smtp]"]
}
2017-08-05 11:17:36,155 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184:    New missing/unsatisfied dependencies:
  service jboss.outbound-socket-binding.mail-smtp (missing) dependents: [service jboss.mail-session.smtpSession] 

------------------ Edited August 7th, 2017 -------------------

As advised by Ladicek I tried this:

 swarm:
   socket-binding-groups:
     standard-sockets:
       mail-socket:
         outbound-socket-bindings:
           mail-smtp:
             remote-host: smtp.someprovider.com
             remote-port: 587

and

swarm:
  socket-binding-groups:
    standard-sockets:
      outbound-socket-bindings:
        mail-smtp:
          remote-host: smtp.someprovider.com
          remote-port: 587

and

swarm:
  socket-binding-groups:
    standard-socket:
      outbound-socket-bindings:
        mail-smtp:
          remote-host: smtp.someprovider.com
          remote-port: 587

However neither is working, still have the same error.

Could anyone please help on this?

---------------------- SOLVED ----------------------------

Need to upgrade to 2017.8.1 and use the below configuration

network:
  socket-binding-groups:
    standard-sockets:
      outbound-socket-bindings:
        mail-smtp:
          remote-host: smtp.someprovider.com
          remote-port: 587

Thank you.


Solution

  • Finally solved:

    Need to upgrade to 2017.8.1 and use the below configuration

    network:
      socket-binding-groups:
        standard-sockets:
          outbound-socket-bindings:
            mail-smtp:
            remote-host: smtp.someprovider.com
            remote-port: 587
    

    Thank you.