diff options
-rw-r--r-- | .gopmfile | 2 | ||||
-rw-r--r-- | .lgtm | 1 | ||||
-rw-r--r-- | glide.lock | 2 | ||||
-rw-r--r-- | glide.yaml | 2 | ||||
-rw-r--r-- | models/mail.go | 2 | ||||
-rw-r--r-- | modules/setting/setting.go | 11 |
6 files changed, 15 insertions, 5 deletions
@@ -35,7 +35,7 @@ github.com/nfnt/resize = commit:891127d github.com/russross/blackfriday = commit:93622da github.com/satori/go.uuid = commit:0aa62d5 github.com/sergi/go-diff = commit:ec7fdbb -github.com/strk/go-libravatar = commit:5eed7bf +strk.kbt.io/projects/go/libravatar = commit:5eed7bf github.com/shurcooL/sanitized_anchor_name = commit:10ef21a github.com/Unknwon/cae = commit:7f5e046 github.com/Unknwon/com = commit:28b053d @@ -0,0 +1 @@ +self_approval_off = false diff --git a/glide.lock b/glide.lock index 0d280df273..e31fc6d651 100644 --- a/glide.lock +++ b/glide.lock @@ -81,7 +81,7 @@ imports: version: ec7fdbb58eb3e300c8595ad5ac74a5aa50019cc7 subpackages: - diffmatchpatch -- name: github.com/strk/go-libravatar +- name: strk.kbt.io/projects/go/libravatar version: 5eed7bff870ae19ef51c5773dbc8f3e9fcbd0982 - name: github.com/shurcooL/sanitized_anchor_name version: 10ef21a441db47d8b13ebcc5fd2310f636973c77 diff --git a/glide.yaml b/glide.yaml index 1d4734eb55..e761d9c2d9 100644 --- a/glide.yaml +++ b/glide.yaml @@ -40,7 +40,7 @@ import: - package: github.com/sergi/go-diff subpackages: - diffmatchpatch -- package: github.com/strk/go-libravatar +- package: strk.kbt.io/projects/go/libravatar - package: golang.org/x/crypto subpackages: - ssh 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 cff3e7dbc2..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" @@ -21,7 +22,7 @@ import ( _ "github.com/go-macaron/cache/redis" "github.com/go-macaron/session" _ "github.com/go-macaron/session/redis" - "github.com/strk/go-libravatar" + "strk.kbt.io/projects/go/libravatar" "gopkg.in/ini.v1" "github.com/gogits/gogs/modules/bindata" @@ -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") } |