2
0
forked from drew/smtprelay

feat: Add support for ignoring certs

This commit is contained in:
Dries De Peuter
2021-12-08 14:41:27 +01:00
parent 6c691f3cea
commit 03d109ff8b
3 changed files with 12 additions and 2 deletions

10
smtp.go
View File

@@ -337,7 +337,10 @@ func SendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) er
}
var c *Client
if port == "465" || port == "smtps" {
config := &tls.Config{ServerName: host}
config := &tls.Config{
ServerName: host,
InsecureSkipVerify: *remoteSkipVerify,
}
conn, err := tls.Dial("tcp", addr, config)
if err != nil {
return err
@@ -360,7 +363,10 @@ func SendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) er
return err
}
if ok, _ := c.Extension("STARTTLS"); ok {
config := &tls.Config{ServerName: c.serverName}
config := &tls.Config{
ServerName: c.serverName,
InsecureSkipVerify: *remoteSkipVerify,
}
if testHookStartTLS != nil {
testHookStartTLS(config)
}