diff options
author | zeripath <art27@cantab.net> | 2022-01-06 00:43:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-06 01:43:45 +0100 |
commit | 1514e13bb86d4714550107efa58c947b1bfc39c6 (patch) | |
tree | d6e1d1cf2543b48b4412f19c80ca76f444e48c3a /modules | |
parent | bf7b083cfe47cc922090ce7922b89f7a5030a44d (diff) | |
download | gitea-1514e13bb86d4714550107efa58c947b1bfc39c6.tar.gz gitea-1514e13bb86d4714550107efa58c947b1bfc39c6.zip |
Add option to convert CRLF to LF line endings for sendmail (#18075)
It appears that several versions of sendmail require that the mail is sent to them with
LF line endings instead of CRLF endings - which of course they will then convert back
to CRLF line endings to comply with the SMTP standard.
This PR adds another setting SENDMAIL_CONVERT_CRLF which will pass the message writer
through a filter. This will filter out and convert CRLFs to LFs before writing them
out to sendmail.
Fix #18024
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/setting/mailer.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/modules/setting/mailer.go b/modules/setting/mailer.go index 1bcd63a914..d7713f3b80 100644 --- a/modules/setting/mailer.go +++ b/modules/setting/mailer.go @@ -37,9 +37,10 @@ type Mailer struct { IsTLSEnabled bool // Sendmail sender - SendmailPath string - SendmailArgs []string - SendmailTimeout time.Duration + SendmailPath string + SendmailArgs []string + SendmailTimeout time.Duration + SendmailConvertCRLF bool } var ( @@ -71,8 +72,9 @@ func newMailService() { IsTLSEnabled: sec.Key("IS_TLS_ENABLED").MustBool(), SubjectPrefix: sec.Key("SUBJECT_PREFIX").MustString(""), - SendmailPath: sec.Key("SENDMAIL_PATH").MustString("sendmail"), - SendmailTimeout: sec.Key("SENDMAIL_TIMEOUT").MustDuration(5 * time.Minute), + SendmailPath: sec.Key("SENDMAIL_PATH").MustString("sendmail"), + SendmailTimeout: sec.Key("SENDMAIL_TIMEOUT").MustDuration(5 * time.Minute), + SendmailConvertCRLF: sec.Key("SENDMAIL_CONVERT_CRLF").MustBool(true), } MailService.From = sec.Key("FROM").MustString(MailService.User) MailService.EnvelopeFrom = sec.Key("ENVELOPE_FROM").MustString("") |