diff --git a/api/src/org/labkey/api/util/SmtpTransportProvider.java b/api/src/org/labkey/api/util/SmtpTransportProvider.java index 5825b583aa4..654af1599d9 100644 --- a/api/src/org/labkey/api/util/SmtpTransportProvider.java +++ b/api/src/org/labkey/api/util/SmtpTransportProvider.java @@ -56,7 +56,7 @@ public String getPropertyName() @Override public String getDescription() { - return "One property for each JavaMail SMTP setting, documented here: https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html"; + return "No longer supported. Configure SMTP settings in application.properties."; } } @@ -69,31 +69,30 @@ public String getName() @Override public void loadConfiguration() { - try - { - // Load from startup properties group "mail_smtp" - ModuleLoader.getInstance().handleStartupProperties( - new LenientStartupPropertyHandler<>("mail_smtp", new SmtpStartupProperty()) + // TODO: Startup failure if SMTP startup properties are present, for now. Remove in 26.11. + ModuleLoader.getInstance().handleStartupProperties( + new LenientStartupPropertyHandler<>("mail_smtp", new SmtpStartupProperty()) + { + @Override + public void handle(Collection entries) { - @Override - public void handle(Collection entries) + if (!entries.isEmpty()) { - entries.forEach(entry -> - _properties.put("mail.smtp." + entry.getName(), entry.getValue())); + throw new ConfigurationException("Configuring SMTP via startup properties is no longer supported. Use application.properties."); } - }); + } + }); - // Fallback: check ServletContext for SMTP settings - if (_properties.isEmpty()) + try + { + // Load SMTP settings from ServletContext (populated from application.properties) + ServletContext context = ModuleLoader.getServletContext(); + Enumeration names = Objects.requireNonNull(context).getInitParameterNames(); + while (names.hasMoreElements()) { - ServletContext context = ModuleLoader.getServletContext(); - Enumeration names = Objects.requireNonNull(context).getInitParameterNames(); - while (names.hasMoreElements()) - { - String name = names.nextElement(); - if (name.startsWith("mail.smtp.")) - _properties.put(name, context.getInitParameter(name)); - } + String name = names.nextElement(); + if (name.startsWith("mail.smtp.")) + _properties.put(name, context.getInitParameter(name)); } // Create session if configured