mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00: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:
parent
485ea6f14f
commit
8a6c86644e
2 changed files with 14 additions and 5 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue