1 Reply Latest reply on Feb 18, 2014 8:37 AM by kcbabo

    Include & in mail service password

    calca

      Hi Guys.

       

      I am trying to configure the mail service. The password contains and &, and I have been not able to find a way to include it!

       

      It seems this is something with camel, but I reached a point that I have this config:

      <mail:binding.mail xmlns:mail="urn:switchyard-component-camel-mail:config:1.0" name="Mail" secure="true">

              <mail:host>mailHost</mail:host>

              <mail:port>25</mail:port>

              <mail:username>user</mail:username>

              <mail:password>thEPassword&More</mail:password>

              <mail:produce>

                <mail:subject>Test</mail:subject>

                <mail:from>warn@mymail.com</mail:from>

                <mail:to>calcacuervo@gmail.com</mail:to>

              </mail:produce>

            </mail:binding.mail>

       

      In the mail:password, I tried many things, using CDATA, replacing the & with &amp or %26, and always getting some error. I debugged until I reached some camel URI helper, org.apache.camel.util.URISupport.normalizeUri(String), and then the parameters gets broken, and I get an error like this:

       

      Caught exception of type org.apache.camel.ResolveEndpointFailedException with message: Failed to resolve endpoint: smtps://email-smtp.us:25?More&from=warn%40me.com&password=thEPassword&subject=Test&to=calcacuervo%40gmail.com&username=ses-smtp-user due to: Failed to resolve endpoint: smtps://email-smtp.com:25?More&from=warn%40me.com&password=thEPassword&subject=Test&to=calcacuervo%40gmail.com&username=ses-smtp-user due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{More=null}]

        Caused by exception of type org.apache.camel.ResolveEndpointFailedException, message: Failed to resolve endpoint: smtps://email-smtp.us:25?More&from=warn%40me.com&password=thEPassword&subject=Test&to=calcacuervo%40gmail.com&username=ses-smtp-user. due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{More=null}]

      org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: smtps://email-smtp.us:25?More&from=warn%40me.com&password=thEPassword&subject=Test&to=calcacuervo%40gmail.com&username=ses-smtp-user.20131121-140404 due to: Failed to resolve endpoint: smtps://email-smtp:25?More&from=me.com&password=thEPassword&subject=Test&to=calcacuervo%40gmail.com&username=ses-smtp-user. due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{More=null}]

       

      I read that you can use the keyword RAW on camel:

      http://camel.apache.org/how-do-i-configure-password-options-on-camel-endpoints-without-the-value-being-encoded.html

       

      and I tried something like this:

      <mail:password>RAW(<![CDATA[thEPassword%26More]]>)</mail:password>

      or

        <mail:password><![CDATA[RAW(thEPassword%26More)]]></mail:password>

      but no luck, the same

      5?More%29&from=warn%40me.com&password=RAW%28thEPassword&subject=Test&to=c

       

      Any idea on how I could solve it?

       

      Thanks in advance,

       

      Demian

        • 1. Re: Include & in mail service password
          kcbabo

          Are you sure this doesn't work?

          <mail:password>thEPassword%26More</mail:password>
          


          I tried out the above with our camel-ftp-binding quickstart and it worked fine.  FWIW, the following also worked:

          <mail:password>thEPassword&amp;More</mail:password>