spring-integration icon indicating copy to clipboard operation
spring-integration copied to clipboard

Encode URL in mail components

Open binaymishra opened this issue 4 years ago • 5 comments

In what version(s) of Spring Integration are you seeing this issue?

For example:

5.3.8.RELEASE

Between 4.3.15 and 5.2.5

Describe the bug Getting UnknownHostException if imap password contains '@' character. for Example : spring: imapUser: 'username' imapSecret: 'springmail@123'

'imaps://${spring.imapUser}:${spring.imapSecret}@${spring.imapHost}:993/INBOX' Caused by: java.net.UnknownHostException: [email protected] in case

To Reproduce

Steps to reproduce the behavior.

Expected behavior

A clear and concise description of what you expected to happen.

Sample

A link to a GitHub repository with a minimal, reproducible sample.

Reports that include a sample will take priority over reports that do not. At times, we may require a sample, so it is good to try and include a sample up front.

binaymishra avatar Sep 22 '21 05:09 binaymishra

You have to encode special characters (e.g. %40 for @) in URLs.

https://stackoverflow.com/questions/57205851/how-do-i-escape-the-character-when-setting-up-my-store-uri-in-spring-integrati

garyrussell avatar Sep 22 '21 12:09 garyrussell

It was always like that and there is nothing Spring Integration specific. So, yes, better to start from Stack Overflow question first before raising issue over here.

So, closing as Invalid and reference to existing similar SO question and its answer like Gary has just done.

artembilan avatar Sep 22 '21 12:09 artembilan

There is also a message note in the docs: https://docs.spring.io/spring-integration/docs/current/reference/html/mail.html#mail-namespace

If your username contains the '@' character, use '%40' instead of '@' to avoid parsing errors from the underlying JavaMail API.

artembilan avatar Sep 22 '21 12:09 artembilan

After some team discussion we decided to reopen this issue with a decision to introduce an encodeUrl in the next 6.0 version, with true by default.

artembilan avatar Sep 22 '21 13:09 artembilan

Thanks @garyrussell, @artembilan yes, I'll try to find answers from stackoverflow first, regret for inconvenience

binaymishra avatar Sep 22 '21 15:09 binaymishra