Skip to content

Commit

Permalink
Set server name in STARTTLS client
Browse files Browse the repository at this point in the history
  • Loading branch information
JenswBE committed Dec 29, 2023
1 parent c4eb8e9 commit addafa5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion send/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ func createSTARTTLSClient(host string, port uint, allowInsecureTLS bool) (*smtp.
}

// Switch to STARTTLS
err = client.StartTLS(&tls.Config{InsecureSkipVerify: allowInsecureTLS}) // #nosec G402
tlsConfig := &tls.Config{
ServerName: host,
InsecureSkipVerify: allowInsecureTLS,
}
err = client.StartTLS(tlsConfig) // #nosec G402
if err != nil {
return nil, fmt.Errorf("failed to switch to TLS using STARTTLS on server %s: %w", hostPort, err)
}
Expand Down

0 comments on commit addafa5

Please sign in to comment.