{"record":{"id":"5066d7c7774459e2","repo":"SonarSource/sonarqube","slug":"unknown-type-of-smtp-secure-connection","errorCode":null,"errorMessage":"Unknown type of SMTP secure connection: ","messagePattern":"Unknown type of SMTP secure connection: ","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server/sonar-server-common/src/main/java/org/sonar/server/email/EmailSender.java","lineNumber":131,"sourceCode":"\n  private void configureSecureConnection(MultiPartEmail email) {\n    if (CI.equals(emailSmtpConfiguration.getSecureConnection(), \"SSLTLS\")) {\n      email.setSSLOnConnect(true);\n      email.setSSLCheckServerIdentity(true);\n      email.setSslSmtpPort(String.valueOf(emailSmtpConfiguration.getSmtpPort()));\n\n      // this port is not used except in EmailException message, that's why it's set with the same value than SSL port.\n      // It prevents from getting bad message.\n      email.setSmtpPort(emailSmtpConfiguration.getSmtpPort());\n    } else if (CI.equals(emailSmtpConfiguration.getSecureConnection(), \"STARTTLS\")) {\n      email.setStartTLSEnabled(true);\n      email.setStartTLSRequired(true);\n      email.setSSLCheckServerIdentity(true);\n      email.setSmtpPort(emailSmtpConfiguration.getSmtpPort());\n    } else if (CI.equals(emailSmtpConfiguration.getSecureConnection(), \"NONE\")) {\n      email.setSmtpPort(emailSmtpConfiguration.getSmtpPort());\n    } else {\n      throw new IllegalStateException(\"Unknown type of SMTP secure connection: \" + emailSmtpConfiguration.getSecureConnection());\n    }\n  }\n\n}\n","sourceCodeStart":113,"sourceCodeEnd":136,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-server-common/src/main/java/org/sonar/server/email/EmailSender.java#L113-L136","documentation":"EmailSender.configureSecureConnection supports exactly three `sonar.email.smtp.secureConnection` values: SSL, STARTTLS, and NONE. Any other value throws an IllegalStateException when an email notification is being sent, since commons-email's email object cannot be safely configured without a known security mode.","triggerScenarios":"Setting sonar.email.smtp.secureConnection in sonar.properties or the Administration > Email settings to a value other than SSL/STARTTLS/NONE (e.g. `ssl` lowercase handled elsewhere, `tls`, `none ` with whitespace), then triggering an email.","commonSituations":"Documentation confusion between `STARTTLS` and `TLS`; values copied from other mail clients (`ssl/tls`); trailing spaces or wrong case in the settings UI.","solutions":["Set secureConnection to exactly `SSL`, `STARTTLS`, or `NONE` (uppercase, no whitespace).","Use `STARTTLS` for TLS-upgrade SMTP (typically port 587), `SSL` for implicit TLS (port 465).","Leave empty or set `NONE` for unauthenticated local relays.","Re-test by triggering a test notification after saving settings."],"exampleFix":"// before (sonar.properties)\nsonar.email.smtp.secureConnection=tls\n// after\nsonar.email.smtp.secureConnection=STARTTLS","handlingStrategy":"validation","validationCode":"String sc = settings.optString(\"sonar.email.smtp.secureConnection\", \"NONE\").trim().toUpperCase(Locale.ROOT);\nif (!Set.of(\"SSL\", \"STARTTLS\", \"NONE\").contains(sc)) {\n  throw new IllegalArgumentException(\"secureConnection must be SSL, STARTTLS or NONE: \" + sc);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a dropdown/enum in config tooling instead of free text.","Match case exactly: SSL, STARTTLS, NONE.","Pair the mode with the correct port (465 for SSL, 587 for STARTTLS)."],"tags":["email","smtp","configuration"],"backgroundTag":"invalid-enum-value","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}