-
Bug
-
Resolution: Done
-
Major
-
fuse-7.10-GA
-
None
The Camel documentation states abut the session option to the mail component:
"Specifies the mail session that camel should use for all mail interactions. Useful in scenarios where mail sessions are created and managed by some other resource, such as a JavaEE container. When using a custom mail session, then the hostname and port from the mail session will be used (if configured on the session). The option is a javax.mail.Session type."
However, when configuring a mail session in JBoss with different host/port information that is provided in the base URI of the route:
standalone.xml config:
<subsystem xmlns="urn:jboss:domain:mail:4.0">
<mail-session name="default" jndi-name="java:jboss/mail/Default">
<smtp-server outbound-socket-binding-ref="mail-smtp" username="testuser" password="password"/>
</mail-session>
</subsystem>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="node1.test.redhat.com" port="25"/>
</outbound-socket-binding>
Camel config:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- Look up the GreenMail mail session from JNDI -->
<jee:jndi-lookup id="mailSession" jndi-name="java:jboss/mail/Default"/>
<camelContext xmlns="http://camel.apache.org/schema/spring" id="mail-camel-context">
<!-- Configure routes and endpoints to send and receive email over SMTP and POP3 -->
<route id="directToSmtpRoute">
<from id="directConsumer" uri="direct:sendmail" />
<to id="smtpProducer" uri="smtp://localhost:2525?session=#jndiMailSession" />
</route>
</camelContext>
</beans>
the mail component continues to use the host:port information specified in the core URI of the route instead of looking up the values from the session parameter.