diff options
Diffstat (limited to 'modules/mailer/mailer.go')
-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)) |