diff options
author | Dmitry Azhichakov <dmitry@dsa.pp.ru> | 2015-02-12 18:54:51 +0300 |
---|---|---|
committer | Dmitry Azhichakov <dmitry@dsa.pp.ru> | 2015-02-12 18:54:51 +0300 |
commit | 8a6c86644e6d73421e325c937916cefe7495bc38 (patch) | |
tree | 3213eb7b5a2a095daab8039cde84e7436d2d8534 /modules/mailer | |
parent | 485ea6f14f38cfa5da4fa27865f62fcc7691ffb4 (diff) | |
download | gitea-8a6c86644e6d73421e325c937916cefe7495bc38.tar.gz gitea-8a6c86644e6d73421e325c937916cefe7495bc38.zip |
New feature: SMTP connection may use client certificate.
New config keys in [mailer] section:
- CERT_FILE: path to a certificate file.
- KEY_FILE: path to a key file.
Diffstat (limited to 'modules/mailer')
-rw-r--r-- | modules/mailer/mailer.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/mailer/mailer.go b/modules/mailer/mailer.go index 6a23e5d09e..792e443543 100644 --- a/modules/mailer/mailer.go +++ b/modules/mailer/mailer.go @@ -72,9 +72,15 @@ 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}, } conn, err := net.Dial("tcp", net.JoinHostPort(host, port)) |