summaryrefslogtreecommitdiffstats
path: root/modules/mailer
diff options
context:
space:
mode:
authorDmitry Azhichakov <dmitry@dsa.pp.ru>2015-02-13 10:33:55 +0300
committerDmitry Azhichakov <dmitry@dsa.pp.ru>2015-02-13 10:33:55 +0300
commit3aaf292ba8c222003048e695bf9b9ec43191ff01 (patch)
treef2453bcaf4dd8f037288542cc747d11c8cc17d94 /modules/mailer
parent8a6c86644e6d73421e325c937916cefe7495bc38 (diff)
downloadgitea-3aaf292ba8c222003048e695bf9b9ec43191ff01.tar.gz
gitea-3aaf292ba8c222003048e695bf9b9ec43191ff01.zip
Fix "forcing" client certificate for SMTP
Diffstat (limited to 'modules/mailer')
-rw-r--r--modules/mailer/mailer.go14
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))