diff options
author | Philip Couling <couling@gmail.com> | 2016-12-25 13:55:22 +0000 |
---|---|---|
committer | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2016-12-25 14:55:22 +0100 |
commit | d4924d45d6d4e991240d207a834d8d6709781449 (patch) | |
tree | bdf6c450d7712ba17c2b06fba45cdeb0579090ec /modules/setting/setting.go | |
parent | 8de8ec027d1ca44f889b89a69b26c3a9b599bbb6 (diff) | |
download | gitea-d4924d45d6d4e991240d207a834d8d6709781449.tar.gz gitea-d4924d45d6d4e991240d207a834d8d6709781449.zip |
Implement sendmail (#355)
* Implemented sendmail. This piggybacks on existing configuration to keep the change simple
* Changed privicy of new sendSMTP and sendSendmail functions
* Fixed Lint errors
* Seperated SMTP and sendmail into their own senders
* Making new structs private as they should not be used externally now
* Added sendmail setting to ini file
* Minor code cleanup
Diffstat (limited to 'modules/setting/setting.go')
-rw-r--r-- | modules/setting/setting.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index fad884ae1e..81fcb4b150 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -858,18 +858,25 @@ func newSessionService() { // Mailer represents mail service. type Mailer struct { + // Mailer QueueLength int Name string - Host string From string FromEmail string + EnableHTMLAlternative bool + + // SMTP sender + Host string User, Passwd string DisableHelo bool HeloHostname string SkipVerify bool UseCertificate bool CertFile, KeyFile string - EnableHTMLAlternative bool + + // Sendmail sender + UseSendmail bool + SendmailPath string } var ( @@ -887,6 +894,8 @@ func newMailService() { MailService = &Mailer{ QueueLength: sec.Key("SEND_BUFFER_LEN").MustInt(100), Name: sec.Key("NAME").MustString(AppName), + EnableHTMLAlternative: sec.Key("ENABLE_HTML_ALTERNATIVE").MustBool(), + Host: sec.Key("HOST").String(), User: sec.Key("USER").String(), Passwd: sec.Key("PASSWD").String(), @@ -896,7 +905,9 @@ func newMailService() { UseCertificate: sec.Key("USE_CERTIFICATE").MustBool(), CertFile: sec.Key("CERT_FILE").String(), KeyFile: sec.Key("KEY_FILE").String(), - EnableHTMLAlternative: sec.Key("ENABLE_HTML_ALTERNATIVE").MustBool(), + + UseSendmail: sec.Key("USE_SENDMAIL").MustBool(), + SendmailPath: sec.Key("SENDMAIL_PATH").MustString("sendmail"), } MailService.From = sec.Key("FROM").MustString(MailService.User) |