diff options
author | 无闻 <u@gogs.io> | 2015-02-28 22:25:48 -0500 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2015-02-28 22:25:48 -0500 |
commit | 3db80f2c555316b92b2be0cb0a53adb37eca910a (patch) | |
tree | 1698c52fbe2aea31c48eda76909783d94794413e /modules/mailer | |
parent | a6a2f59d1da927a1fae9d009f58e63881c4c029a (diff) | |
parent | 2692d4aa49deec286058cd2196da379a97534787 (diff) | |
download | gitea-3db80f2c555316b92b2be0cb0a53adb37eca910a.tar.gz gitea-3db80f2c555316b92b2be0cb0a53adb37eca910a.zip |
Merge pull request #943 from diseaz/mailer-client-cert
Use client certificate for SMTP over TLS
Diffstat (limited to 'modules/mailer')
-rw-r--r-- | modules/mailer/mailer.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/mailer/mailer.go b/modules/mailer/mailer.go index fc6ec2fa86..74a3fca578 100644 --- a/modules/mailer/mailer.go +++ b/modules/mailer/mailer.go @@ -78,6 +78,14 @@ func sendMail(settings *setting.Mailer, recipients []string, msgContent []byte) ServerName: host, } + 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)) if err != nil { return err |