Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions conf/app.ini
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ SEND_AS_PLAIN_TEXT = false
USE_SENDMAIL = false
; Specify an alternative sendmail binary
SENDMAIL_PATH = sendmail
; Specify any extra sendmail arguments
SENDMAIL_ARGS =

[cache]
; Either "memory", "redis", or "memcache", default is "memory"
Expand Down
1 change: 1 addition & 0 deletions modules/mailer/mailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down
7 changes: 7 additions & 0 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -1326,6 +1327,7 @@ type Mailer struct {
// Sendmail sender
UseSendmail bool
SendmailPath string
SendmailArgs []string
}

var (
Expand Down Expand Up @@ -1372,6 +1374,11 @@ func newMailService() {
MailService.FromName = parsed.Name
MailService.FromEmail = parsed.Address

MailService.SendmailArgs, err = shellquote.Split(sec.Key("SENDMAIL_ARGS").String())
Copy link
Member

@lafriks lafriks Oct 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be it's worth load this (and also parse ) only if MailService.UseSendmail is enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if err != nil && MailService.UseSendmail {
log.Error(4, "Failed to parse Sendmail args: %v", CustomConf, err)
}

log.Info("Mail Service Enabled")
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,12 @@
"revision": "b2c7a7da5b2995941048f60146e67702a292e468",
"revisionTime": "2016-02-12T04:00:40Z"
},
{
"checksumSHA1": "+IzngblnBQNh+GmsS2O7jqmzSVQ=",
"path": "github.com/kballard/go-shellquote",
"revision": "cd60e84ee657ff3dc51de0b4f55dd299a3e136f2",
"revisionTime": "2017-06-19T18:30:22Z"
},
{
"checksumSHA1": "VJk3rOWfxEV9Ilig5lgzH1qg8Ss=",
"path": "github.com/keybase/go-crypto/brainpool",
Expand Down