jboss-eap-7wildfly-11

JBoss 7.1.0: Add Default Sender to mail sub system


I have some troubles adding a default sender to my mail subsystem in JBoss EAP 7.1.0. I'm a noob with the JBoss cli ;)

Here is my current standalone.xml:

<subsystem xmlns="urn:jboss:domain:mail:3.0">
  <mail-session name="java:jboss/mail/Default" jndi-name="java:jboss/mail/Default">
    <smtp-server outbound-socket-binding-ref="mail-smtp"/>
  </mail-session>
</subsystem>

What i want (i figured out, that the property I need is call mail.smtp.from)

<subsystem xmlns="urn:jboss:domain:mail:3.0">
  <mail-session name="java:jboss/mail/Default" jndi-name="java:jboss/mail/Default">
    <smtp-server outbound-socket-binding-ref="mail-smtp">
       <property name="mail.smtp.from" value="test@test.de"/>
    </smtp-server>
  </mail-session>
</subsystem>

I tried a lot with autocompletion in the JBoss CLI, but no success. My current try is:

/subsystem=mail/mail-session=java\:jboss\/mail\/Default/smtp-server/property=mail.smtp.from:write-attribute(name=value, value=test@test.de)

This leads to "Node path format is wrong around 'smtp-server'. Hope someone can help. Thanks in advance!


Solution

  • I believe what you need is the following, with the from attribute held by the mail-session object :

    <subsystem xmlns="urn:jboss:domain:mail:3.0">
      <mail-session name="java:jboss/mail/Default" jndi-name="java:jboss/mail/Default" from="test@test.de">
        <smtp-server outbound-socket-binding-ref="mail-smtp"/>
      </mail-session>
    </subsystem>
    

    Which you can obtain from your current configuration by running the following CLI command :

    /subsystem=mail/mail-session=java\:jboss\/mail\/Default:write-attribute(name=from, value=test@test.de)