Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode URL in mail components #3634

Closed
binaymishra opened this issue Sep 22, 2021 · 7 comments
Closed

Encode URL in mail components #3634

binaymishra opened this issue Sep 22, 2021 · 7 comments
Labels
in: mail status: declined There won't be a fix for some reason type: enhancement

Comments

@binaymishra
Copy link

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: 123@imap7.xxx.com 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 binaymishra added status: waiting-for-triage The issue need to be evaluated and its future decided type: bug labels Sep 22, 2021
@garyrussell
Copy link
Contributor

@garyrussell garyrussell added status: waiting-for-reporter Needs a feedback from the reporter and removed type: bug status: waiting-for-triage The issue need to be evaluated and its future decided labels Sep 22, 2021
@artembilan
Copy link
Member

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 artembilan added status: invalid Not reproducable or not relevant to the current state of the project and removed status: waiting-for-reporter Needs a feedback from the reporter labels Sep 22, 2021
@artembilan
Copy link
Member

artembilan commented Sep 22, 2021

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 artembilan changed the title spring-integration-mail-5.3.8.RELEASE Encode URL in mail components Sep 22, 2021
@artembilan artembilan added in: mail type: enhancement and removed status: invalid Not reproducable or not relevant to the current state of the project labels Sep 22, 2021
@artembilan artembilan added this to the 6.0.x milestone Sep 22, 2021
@artembilan
Copy link
Member

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 artembilan reopened this Sep 22, 2021
@binaymishra
Copy link
Author

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

@artembilan artembilan modified the milestones: 6.0.x, 6.1.x Jan 17, 2023
@artembilan artembilan modified the milestones: 6.1.x, 6.1.0-RC1 Apr 13, 2023
@artembilan artembilan added the status: declined There won't be a fix for some reason label Apr 13, 2023
@artembilan
Copy link
Member

Turns out there is nothing needed to be added into the framework.
There is already a special system property for Java Mail to set: mail.URLName.dontencode.
It is used in the URLName for encoding and decoding (or not) exactly username and password parts for the provided URL:

this.username = doEncode ? encode(username) : username;
this.password = doEncode ? encode(password) : password;

@artembilan artembilan closed this as not planned Won't fix, can't repro, duplicate, stale Apr 13, 2023
@binaymishra
Copy link
Author

cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: mail status: declined There won't be a fix for some reason type: enhancement
Projects
None yet
Development

No branches or pull requests

3 participants