mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Add support for extra sendmail arguments (#2731)
* Add support for extra sendmail arguments * Sendmail args to exec.command should be a list * Add go-shellquote package * Use go-shellquote lib for parsing Sendmail args * Only parse if sendmail is configured
This commit is contained in:
parent
3af5b67ed0
commit
e86a0bf3fe
9 changed files with 322 additions and 0 deletions
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue