diff --git a/src/main/scala/gitbucket/core/util/Notifier.scala b/src/main/scala/gitbucket/core/util/Notifier.scala index 61f3c68..c0bd832 100644 --- a/src/main/scala/gitbucket/core/util/Notifier.scala +++ b/src/main/scala/gitbucket/core/util/Notifier.scala @@ -60,6 +60,10 @@ } def send(to: String, subject: String, loginAccount: Account, textMsg: String, htmlMsg: Option[String] = None): Unit = { + send(to, subject, textMsg, htmlMsg, Some(loginAccount)) + } + + def send(to: String, subject: String, textMsg: String, htmlMsg: Option[String] = None, loginAccount: Option[Account] = None): Unit = { val email = new HtmlEmail email.setHostName(smtp.host) email.setSmtpPort(smtp.port.get) @@ -77,8 +81,8 @@ email.setStartTLSRequired(starttls) } smtp.fromAddress - .map (_ -> smtp.fromName.getOrElse(loginAccount.userName)) - .orElse (Some("notifications@gitbucket.com" -> loginAccount.userName)) + .map (_ -> smtp.fromName.getOrElse(loginAccount.map(_.userName).getOrElse("GitBucket"))) + .orElse (Some("notifications@gitbucket.com" -> loginAccount.map(_.userName).getOrElse("GitBucket"))) .foreach { case (address, name) => email.setFrom(address, name) }