From 2987c222b9ba77e1b542269173da9da53315d7f8 Mon Sep 17 00:00:00 2001 From: Florian M Date: Fri, 9 Dec 2022 20:33:11 +0100 Subject: [PATCH 1/2] Respect mail.smtp.auth setting --- CHANGELOG.unreleased.md | 1 + app/Startup.scala | 1 + app/oxalis/mail/Mailer.scala | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index f926b99ae1a..b858d9f43d2 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -26,6 +26,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Fixed import of remote datasets with multiple layers and differing resolution pyramid. #[6670](https://github.com/scalableminds/webknossos/pull/6670) - Fixed broken Get-new-Task button in task dashboard. [#6677](https://github.com/scalableminds/webknossos/pull/6677) - Fixed access of remote datasets using the Amazon S3 protocol [#6679](https://github.com/scalableminds/webknossos/pull/6679) +- 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 0e343e4e38c..2c073d5a6a0 100755 --- a/app/Startup.scala +++ b/app/Startup.scala @@ -117,6 +117,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..d6e3b214fb0 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") From fc868908d0d1c0e2a985b45f581c2b63329b43e3 Mon Sep 17 00:00:00 2001 From: Florian M Date: Tue, 13 Dec 2022 15:56:06 +0100 Subject: [PATCH 2/2] remove unused config field mail.reply --- app/oxalis/mail/Mailer.scala | 5 ++--- conf/application.conf | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/oxalis/mail/Mailer.scala b/app/oxalis/mail/Mailer.scala index d6e3b214fb0..0835860d8a7 100644 --- a/app/oxalis/mail/Mailer.scala +++ b/app/oxalis/mail/Mailer.scala @@ -72,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 @@ -80,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 = ""