Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7431

Impossible to use an existing javax.mail.Session with DefaultJavaMailSender

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.13.0
    • 2.12.4, 2.13.2, 2.14.0
    • camel-mail
    • None
    • Windows 8.1.1, Oracle JDK6u45, JavaMail 1.4.7

    • Moderate

    Description

      When using DefaultJavaMailSender with an existing javax.mail.Session instance (i.e. retrieved from JNDI) it is not possible to leave host and port unconfigured.

      My JavaMailSender is configured as follows:

      @Bean
      public JavaMailSender mailSender()

      { JavaMailSender jms = new DefaultJavaMailSender(); jms.setSession(mailSession); jms.setProtocol("smtp"); return jms; }

      mailSession is a preconfigured Session instance retrieved from JNDI registry. I do not know about it's configuration.

      When calling the send() method, it tries to connect using the connect(host, port, username, password) method passing the (unconfigured) host and port which defaults to localhost:0 and then fails.

      In case the session is supplied, it should call connect() instead.

      Attachments

        Activity

          People

            njiang Willem Jiang
            smokeshield Pierre Maréchal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: