From ad55d5199d239678dbc8fad30ceac9764aa9b87e Mon Sep 17 00:00:00 2001 From: Uli Heller Date: Sat, 27 Jun 2015 08:45:27 +0200 Subject: [PATCH] Use '{loginName} {fromAddress}' for the from field within the notification emails --- doc/README.email-sender.md | 12 ++++++++++++ src/main/scala/gitbucket/core/util/Notifier.scala | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 doc/README.email-sender.md diff --git a/doc/README.email-sender.md b/doc/README.email-sender.md new file mode 100644 index 000000000..d7ef1a105 --- /dev/null +++ b/doc/README.email-sender.md @@ -0,0 +1,12 @@ +Email Sender +============ + +As of gitbucket 3.4, the sender of the notification emails is build like this: + +* {fromName} {fromAddress} ... in case you configured both of them +* {loginName} notifications@gitbucket.com ... in case you configured none of them +* {fromAddress} ... in case you configured only the from address + +For me, I'd like to see this: + +* {loginName} {fromAddress} ... when from name isn't configured diff --git a/src/main/scala/gitbucket/core/util/Notifier.scala b/src/main/scala/gitbucket/core/util/Notifier.scala index b7dbbe8e9..b88a4e15f 100644 --- a/src/main/scala/gitbucket/core/util/Notifier.scala +++ b/src/main/scala/gitbucket/core/util/Notifier.scala @@ -87,7 +87,7 @@ class Mailer(private val smtp: Smtp) extends Notifier { email.setSSLOnConnect(ssl) } smtp.fromAddress - .map (_ -> smtp.fromName.orNull) + .map (_ -> smtp.fromName.getOrElse(context.loginAccount.get.userName)) .orElse (Some("notifications@gitbucket.com" -> context.loginAccount.get.userName)) .foreach { case (address, name) => email.setFrom(address, name)