summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorSandro Santilli <strk@kbt.io>2016-09-07 11:19:44 +0200
committerSandro Santilli <strk@kbt.io>2016-11-02 21:00:54 +0100
commitaf03d00780a6ee70c58e135c6679542cde4f8d50 (patch)
tree5aa8f9cdb9dd7e85da3d559dfcde2d7f231366f4 /modules
parent5c5424301443ffa3659737d12de48ab1dfe39a00 (diff)
downloadgitea-af03d00780a6ee70c58e135c6679542cde4f8d50.tar.gz
gitea-af03d00780a6ee70c58e135c6679542cde4f8d50.zip
Fix sender of issue notifications
It is the FROM field in mailer configuration that needs be used, not the USER field, which is for authentication. Closes https://github.com/gogits/gogs/issues/3615
Diffstat (limited to 'modules')
-rw-r--r--modules/setting/setting.go9
1 files changed, 9 insertions, 0 deletions
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")
}