2

I have the following problem: How do I send an email using Wildfly when the SMTP doesn't need a password?

I already succeeded doing this using Glassfish. But when I migrate to Wildfly, I don't know what parameter I need to pass.

This is my Glassfish configuration:

enter image description here

This is my standalone.xml:

<mail-session name="noreply" jndi-name="java:jboss/mail/noreply" from="something@domainblablabla.com">
                <smtp-server outbound-socket-binding-ref="blablabla-smtp" ssl="true" tls="false" username="something@domainblablabla.com"/>
</mail-session>

<outbound-socket-binding name="blablabla-smtp">
            <remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
TT.
  • 15,774
  • 6
  • 47
  • 88
user2571094
  • 177
  • 1
  • 3
  • 12

2 Answers2

2

I didn't found the setting in wildfly, but i edit the code following this answer.

Send mail in javax.mail without authentication

this solve my problem.

Community
  • 1
  • 1
user2571094
  • 177
  • 1
  • 3
  • 12
1

You can define custom-server in mail-session definition where you can define whatever java mail properties you want.

example from some testcase

<mail-session name="custom" debug="true" jndi-name="java:jboss/mail/Custom">
        <custom-server name="smtp" username="username" password="password">
            <property name="host" value="mail.example.com"/>
        </custom-server>
        <custom-server name="pop3" outbound-socket-binding-ref="mail-pop3">
            <property name="custom_prop" value="some-custom-prop-value"/>
            <property name="some.fully.qualified.property" value="fully-qualified-prop-name"/>
        </custom-server>
    </mail-session>
Tomaz Cerar
  • 5,761
  • 25
  • 32