mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-09 03:08:05 +02:00
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.
This commit is contained in:
1 parent
485ea6f14f
commit
8a6c86644e
2 files changed
+14
-5
No files matched your search
@@ -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))
|
||||
|
||||
Reference in new issue
Block a user