diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 22f69d7415e..e798561c7e6 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -29,6 +29,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Fixed access of remote datasets using the Amazon S3 protocol [#6679](https://github.com/scalableminds/webknossos/pull/6679) - Fixed a bug in line measurement that would lead to an infinite loop. [#6689](https://github.com/scalableminds/webknossos/pull/6689) - Fixed a bug where malformed json files could lead to uncaught exceptions.[#6691](https://github.com/scalableminds/webknossos/pull/6691) +- Respect the config value mail.smtp.auth (used to be ignored, always using true) [#6692](https://github.com/scalableminds/webknossos/pull/6692) ### Removed diff --git a/app/Startup.scala b/app/Startup.scala index d045857b701..72fa3d67ad5 100755 --- a/app/Startup.scala +++ b/app/Startup.scala @@ -120,6 +120,7 @@ class Startup @Inject()(actorSystem: ActorSystem, conf.Mail.Smtp.host, conf.Mail.Smtp.port, conf.Mail.Smtp.tls, + conf.Mail.Smtp.auth, conf.Mail.Smtp.user, conf.Mail.Smtp.pass, ) diff --git a/app/oxalis/mail/Mailer.scala b/app/oxalis/mail/Mailer.scala index 1ca26b46f88..0835860d8a7 100644 --- a/app/oxalis/mail/Mailer.scala +++ b/app/oxalis/mail/Mailer.scala @@ -20,6 +20,7 @@ case class MailerConfig( smtpHost: String, smtpPort: Int, smtpTls: Boolean, + smtpAuth: Boolean, smtpUser: String, smtpPass: String, ) @@ -54,7 +55,9 @@ class Mailer(conf: MailerConfig) extends Actor with LazyLogging { multiPartMail.setHostName(conf.smtpHost) multiPartMail.setSmtpPort(conf.smtpPort) multiPartMail.setStartTLSEnabled(conf.smtpTls) - multiPartMail.setAuthenticator(new DefaultAuthenticator(conf.smtpUser, conf.smtpPass)) + if (conf.smtpAuth) { + multiPartMail.setAuthenticator(new DefaultAuthenticator(conf.smtpUser, conf.smtpPass)) + } multiPartMail.setDebug(false) multiPartMail.getMailSession.getProperties.put("mail.smtp.ssl.protocols", "TLSv1.2") @@ -69,7 +72,7 @@ class Mailer(conf: MailerConfig) extends Actor with LazyLogging { /** * Extracts an email address from the given string and passes to the enclosed method. */ - private def setAddress(emailAddress: String)(setter: (String, String) => _) { + private def setAddress(emailAddress: String)(setter: (String, String) => _): Unit = try { val iAddress = new InternetAddress(emailAddress) val address = iAddress.getAddress @@ -77,9 +80,8 @@ class Mailer(conf: MailerConfig) extends Actor with LazyLogging { setter(address, name) } catch { - case _: Exception => () + case e: Exception => logger.warn(s"Failed to set email address: $e") } - } /** * Creates an appropriate email object based on the content type. diff --git a/conf/application.conf b/conf/application.conf index 36e96538a53..b4a12a5fe7a 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -181,7 +181,6 @@ mail { pass = "" } defaultSender = "webKnossos " - reply = "webKnossos " mailchimp { host = "" listId = ""