From c3252626e37e3cd71ec0f82b31b55c29a1876b8e Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Mon, 11 Nov 2024 13:31:02 +0100 Subject: [PATCH] Reverted change made in 3fffcd15f618a8196f90871eba8b51aeaa71f18f --- smtp/smtp.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/smtp/smtp.go b/smtp/smtp.go index 943ca9d..4841ec8 100644 --- a/smtp/smtp.go +++ b/smtp/smtp.go @@ -432,6 +432,8 @@ func (c *Client) Data() (io.WriteCloser, error) { return datacloser, nil } +var testHookStartTLS func(*tls.Config) // nil, except for tests + // SendMail connects to the server at addr, switches to TLS if // possible, authenticates with the optional mechanism a if possible, // 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 { config := &tls.Config{ServerName: c.serverName} + if testHookStartTLS != nil { + testHookStartTLS(config) + } if err = c.StartTLS(config); err != nil { return err }