Remove deprecated test hook for STARTTLS

The testHookStartTLS variable and its related conditional code have been removed from the smtp.go file. This cleanup streamlines the TLS initiation process and removes unnecessary test-specific hooks no longer in use.
This commit is contained in:
Winni Neessen 2024-11-11 12:54:39 +01:00
parent e9c7bdbb4e
commit 3fffcd15f6
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -432,8 +432,6 @@ 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
@ -475,9 +473,6 @@ 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
} }