diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mailer/mailer.go | 1 | ||||
-rw-r--r-- | modules/setting/setting.go | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/modules/mailer/mailer.go b/modules/mailer/mailer.go index 0bb78de92a..a54e836173 100644 --- a/modules/mailer/mailer.go +++ b/modules/mailer/mailer.go @@ -209,6 +209,7 @@ func (s *sendmailSender) Send(from string, to []string, msg io.WriterTo) error { var waitError error args := []string{"-F", from, "-i"} + args = append(args, setting.MailService.SendmailArgs...) args = append(args, to...) log.Trace("Sending with: %s %v", setting.MailService.SendmailPath, args) cmd := exec.Command(setting.MailService.SendmailPath, args...) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index cb8cf7d39a..7706ee3e95 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -35,6 +35,7 @@ import ( "github.com/go-macaron/session" _ "github.com/go-macaron/session/redis" // redis plugin for store session "github.com/go-xorm/core" + "github.com/kballard/go-shellquote" "gopkg.in/ini.v1" "strk.kbt.io/projects/go/libravatar" ) @@ -1326,6 +1327,7 @@ type Mailer struct { // Sendmail sender UseSendmail bool SendmailPath string + SendmailArgs []string } var ( @@ -1372,6 +1374,13 @@ func newMailService() { MailService.FromName = parsed.Name MailService.FromEmail = parsed.Address + if MailService.UseSendmail { + MailService.SendmailArgs, err = shellquote.Split(sec.Key("SENDMAIL_ARGS").String()) + if err != nil { + log.Error(4, "Failed to parse Sendmail args: %v", CustomConf, err) + } + } + log.Info("Mail Service Enabled") } |