(refs #99) Improved to configure the FROM field of the email.

This commit is contained in:
shimamoto
2013-10-10 23:57:45 +09:00
parent 25bbc00ff3
commit c16b89b0be
4 changed files with 31 additions and 4 deletions

View File

@@ -77,7 +77,12 @@ class Mailer(private val smtp: Smtp) extends Notifier {
smtp.ssl.foreach { ssl =>
email.setSSLOnConnect(ssl)
}
email.setFrom("notifications@gitbucket.com", context.loginAccount.get.userName)
smtp.fromAddress
.map (_ -> smtp.fromName.orNull)
.orElse (Some("notifications@gitbucket.com" -> context.loginAccount.get.userName))
.foreach { case (address, name) =>
email.setFrom(address, name)
}
email.setHtmlMsg(msg(view.Markdown.toHtml(content, r, false, true)))
// TODO Can we use the Database Session in other than Transaction Filter?