diff options
author | Dmitry Azhichakov <dmitry@dsa.pp.ru> | 2015-02-13 10:33:55 +0300 |
---|---|---|
committer | Dmitry Azhichakov <dmitry@dsa.pp.ru> | 2015-02-13 10:33:55 +0300 |
commit | 3aaf292ba8c222003048e695bf9b9ec43191ff01 (patch) | |
tree | f2453bcaf4dd8f037288542cc747d11c8cc17d94 /modules/mailer | |
parent | 8a6c86644e6d73421e325c937916cefe7495bc38 (diff) | |
download | gitea-3aaf292ba8c222003048e695bf9b9ec43191ff01.tar.gz gitea-3aaf292ba8c222003048e695bf9b9ec43191ff01.zip |
Fix "forcing" client certificate for SMTP
Diffstat (limited to 'modules/mailer')
-rw-r--r-- | modules/mailer/mailer.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/mailer/mailer.go b/modules/mailer/mailer.go index 792e443543..f658427c1a 100644 --- a/modules/mailer/mailer.go +++ b/modules/mailer/mailer.go @@ -72,15 +72,17 @@ func sendMail(settings *setting.Mailer, recipients []string, msgContent []byte) return err } - cert, err := tls.LoadX509KeyPair(settings.CertFile, settings.KeyFile) - if err != nil { - return err - } - tlsconfig := &tls.Config{ InsecureSkipVerify: settings.SkipVerify, ServerName: host, - Certificates: []tls.Certificate{cert}, + } + + if settings.UseCertificate { + cert, err := tls.LoadX509KeyPair(settings.CertFile, settings.KeyFile) + if err != nil { + return err + } + tlsconfig.Certificates = []tls.Certificate{cert} } conn, err := net.Dial("tcp", net.JoinHostPort(host, port)) |