Skip to content

Commit 2cbac8c

Browse files
committed
Use go-shellquote lib for parsing Sendmail args
1 parent 1eac726 commit 2cbac8c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/setting/setting.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"github.com/go-macaron/session"
3636
_ "github.com/go-macaron/session/redis" // redis plugin for store session
3737
"github.com/go-xorm/core"
38+
"github.com/kballard/go-shellquote"
3839
"gopkg.in/ini.v1"
3940
"strk.kbt.io/projects/go/libravatar"
4041
)
@@ -1358,7 +1359,6 @@ func newMailService() {
13581359

13591360
UseSendmail: sec.Key("USE_SENDMAIL").MustBool(),
13601361
SendmailPath: sec.Key("SENDMAIL_PATH").MustString("sendmail"),
1361-
SendmailArgs: sec.Key("SENDMAIL_ARGS").Strings(" "),
13621362
}
13631363
MailService.From = sec.Key("FROM").MustString(MailService.User)
13641364

@@ -1374,6 +1374,11 @@ func newMailService() {
13741374
MailService.FromName = parsed.Name
13751375
MailService.FromEmail = parsed.Address
13761376

1377+
MailService.SendmailArgs, err = shellquote.Split(sec.Key("SENDMAIL_ARGS").String())
1378+
if err != nil && MailService.UseSendmail {
1379+
log.Error(4, "Failed to parse Sendmail args: %v", CustomConf, err)
1380+
}
1381+
13771382
log.Info("Mail Service Enabled")
13781383
}
13791384

0 commit comments

Comments
 (0)