diff options
Diffstat (limited to 'services/mailer/mailer.go')
-rw-r--r-- | services/mailer/mailer.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/services/mailer/mailer.go b/services/mailer/mailer.go index eac2b15c3c..e5e6272f10 100644 --- a/services/mailer/mailer.go +++ b/services/mailer/mailer.go @@ -290,13 +290,20 @@ func (s *sendmailSender) Send(from string, to []string, msg io.WriterTo) error { return err } - _, err = msg.WriteTo(pipe) + if setting.MailService.SendmailConvertCRLF { + buf := &strings.Builder{} + _, err = msg.WriteTo(buf) + if err == nil { + _, err = strings.NewReplacer("\r\n", "\n").WriteString(pipe, buf.String()) + } + } else { + _, err = msg.WriteTo(pipe) + } // we MUST close the pipe or sendmail will hang waiting for more of the message // Also we should wait on our sendmail command even if something fails closeError = pipe.Close() waitError = cmd.Wait() - if err != nil { return err } else if closeError != nil { |