Reverted change made in 3fffcd15f6

This commit is contained in:
Winni Neessen 2024-11-11 13:31:02 +01:00
parent 3fffcd15f6
commit c3252626e3
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -432,6 +432,8 @@ func (c *Client) Data() (io.WriteCloser, error) {
return datacloser, nil return datacloser, nil
} }
var testHookStartTLS func(*tls.Config) // nil, except for tests
// SendMail connects to the server at addr, switches to TLS if // SendMail connects to the server at addr, switches to TLS if
// possible, authenticates with the optional mechanism a if possible, // possible, authenticates with the optional mechanism a if possible,
// and then sends an email from address from, to addresses to, with // and then sends an email from address from, to addresses to, with
@ -473,6 +475,9 @@ func SendMail(addr string, a Auth, from string, to []string, msg []byte) error {
} }
if ok, _ := c.Extension("STARTTLS"); ok { if ok, _ := c.Extension("STARTTLS"); ok {
config := &tls.Config{ServerName: c.serverName} config := &tls.Config{ServerName: c.serverName}
if testHookStartTLS != nil {
testHookStartTLS(config)
}
if err = c.StartTLS(config); err != nil { if err = c.StartTLS(config); err != nil {
return err return err
} }