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

Realm Email doesn't default to port 25 #18140

Closed
chuegel opened this issue Aug 14, 2022 · 4 comments
Closed

Realm Email doesn't default to port 25 #18140

chuegel opened this issue Aug 14, 2022 · 4 comments
Assignees
Labels
impact/medium kind/bug Categorizes a PR related to a bug team/ui
Milestone

Comments

@chuegel
Copy link

chuegel commented Aug 14, 2022

Describe the bug

Email configuration of the realm doesen't use the default port:

image

Version

19.0.1

Expected behavior

Emails should be able to be send with the default port 25 but it needs to be explicitly set

Actual behavior

Keycloak tries to send mails without a port:

2022-08-10 14:33:19,499 ERROR [org.keycloak.services.resources.admin.RealmAdminResource] (executor-thread-1095) Failed to send email
 com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.*****.com, 0; timeout 10000;
  nested exception is:
	java.net.SocketTimeoutException: connect timed out

How to Reproduce?

  1. configure SMTP settings and leave port to default (no entry)
  2. try to send mail and watch the errors in the logs
  3. set the port 25 and redo no. 2

Anything else?

No response

@chuegel chuegel added kind/bug Categorizes a PR related to a bug status/triage labels Aug 14, 2022
@ssilvert ssilvert self-assigned this Aug 16, 2022
@ssilvert ssilvert added this to the 20.0.0 milestone Aug 16, 2022
@sls89
Copy link

sls89 commented Aug 16, 2022

I can verify this issue. I had a quick look into the code and in EmailTab.tsx the serverSettings will not be validated, so if "port" is not set, it will be set to 0.

I added a check if the port is 0, but I'm sure there are better solutions to this (just as a hint for the one who is going to fix that)

    for (const [key, mapperFn] of valueMapper.entries()) {
      if (key == "port" && serverSettings[key] == 0) {
        serverSettings[key] = 25;
      }
      serverSettings[key] = mapperFn(serverSettings[key]);
    }

@ssilvert
Copy link
Contributor

@chuegel Can you check my PR keycloak/keycloak-ui#3129 to see if it works for you?

@chuegel
Copy link
Author

chuegel commented Aug 17, 2022

Can't check as Keycloak is running in K8s in an production environment. For now, we set the port manually

@ssilvert
Copy link
Contributor

ssilvert commented Aug 17, 2022

That's OK. I've verified that the new admin console sends the same request as the old console. That should be enough.

Or maybe @sls89 can give my patch a try? It would be nice to know that it works end to end.

Thanks to both of you for helping out.

@ssilvert ssilvert modified the milestones: 20.0.0, 19.0.2 Sep 15, 2022
@ssilvert ssilvert transferred this issue from another repository Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/medium kind/bug Categorizes a PR related to a bug team/ui
Projects
None yet
Development

No branches or pull requests

3 participants