mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-15 02:12:55 +01:00
Reverted change made in 3fffcd15f6
This commit is contained in:
parent
3fffcd15f6
commit
c3252626e3
1 changed files with 5 additions and 0 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue