Skip to content

Commit 731b507

Browse files
committed
Add support for extra sendmail arguments
1 parent 0390030 commit 731b507

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

conf/app.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ SEND_AS_PLAIN_TEXT = false
327327
USE_SENDMAIL = false
328328
; Specify an alternative sendmail binary
329329
SENDMAIL_PATH = sendmail
330+
; Specify any extra sendmail arguments
331+
SENDMAIL_ARGS =
330332

331333
[cache]
332334
; Either "memory", "redis", or "memcache", default is "memory"

modules/mailer/mailer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ func (s *sendmailSender) Send(from string, to []string, msg io.WriterTo) error {
209209
var waitError error
210210

211211
args := []string{"-F", from, "-i"}
212+
args = append(args, setting.MailService.SendmailArgs)
212213
args = append(args, to...)
213214
log.Trace("Sending with: %s %v", setting.MailService.SendmailPath, args)
214215
cmd := exec.Command(setting.MailService.SendmailPath, args...)

modules/setting/setting.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,7 @@ type Mailer struct {
13261326
// Sendmail sender
13271327
UseSendmail bool
13281328
SendmailPath string
1329+
SendmailArgs string
13291330
}
13301331

13311332
var (
@@ -1357,6 +1358,7 @@ func newMailService() {
13571358

13581359
UseSendmail: sec.Key("USE_SENDMAIL").MustBool(),
13591360
SendmailPath: sec.Key("SENDMAIL_PATH").MustString("sendmail"),
1361+
SendmailArgs: sec.Key("SENDMAIL_ARGS").MustString(""),
13601362
}
13611363
MailService.From = sec.Key("FROM").MustString(MailService.User)
13621364

0 commit comments

Comments
 (0)