summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Boerger <thomas@webhippie.de>2016-11-03 09:07:55 +0100
committerGitHub <noreply@github.com>2016-11-03 09:07:55 +0100
commit980282a06fd33cd2d9744fe86e19e9207c47b06b (patch)
treec10f9607943d67259867c226738803b31486761a
parent060d10a4cb6ce5247af1b2f8dec6bf99718d8ec2 (diff)
parentd8de2beb5b92d02a0597ba7c7803839380666653 (diff)
downloadgitea-980282a06fd33cd2d9744fe86e19e9207c47b06b.tar.gz
gitea-980282a06fd33cd2d9744fe86e19e9207c47b06b.zip
Merge branch 'develop' into develop
-rw-r--r--models/mail.go2
-rw-r--r--modules/setting/setting.go9
2 files changed, 10 insertions, 1 deletions
diff --git a/models/mail.go b/models/mail.go
index 0db21355a8..85f1560b44 100644
--- a/models/mail.go
+++ b/models/mail.go
@@ -160,7 +160,7 @@ func composeIssueMessage(issue *Issue, doer *User, tplName base.TplName, tos []s
if err != nil {
log.Error(3, "HTMLString (%s): %v", tplName, err)
}
- msg := mailer.NewMessageFrom(tos, fmt.Sprintf(`"%s" <%s>`, doer.DisplayName(), setting.MailService.User), subject, content)
+ msg := mailer.NewMessageFrom(tos, fmt.Sprintf(`"%s" <%s>`, doer.DisplayName(), setting.MailService.FromEmail), subject, content)
msg.Info = fmt.Sprintf("Subject: %s, %s", subject, info)
return msg
}
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index b3a932e91c..7696c09127 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -6,6 +6,7 @@ package setting
import (
"fmt"
+ "net/mail"
"net/url"
"os"
"os/exec"
@@ -714,6 +715,7 @@ type Mailer struct {
Name string
Host string
From string
+ FromEmail string
User, Passwd string
DisableHelo bool
HeloHostname string
@@ -749,6 +751,13 @@ func newMailService() {
EnableHTMLAlternative: sec.Key("ENABLE_HTML_ALTERNATIVE").MustBool(),
}
MailService.From = sec.Key("FROM").MustString(MailService.User)
+
+ parsed, err := mail.ParseAddress(MailService.From)
+ if err != nil {
+ log.Fatal(4, "Invalid mailer.FROM (%s): %v", MailService.From, err)
+ }
+ MailService.FromEmail = parsed.Address
+
log.Info("Mail Service Enabled")
}