Skip to content

Commit e0e045a

Browse files
committed
as per lafriks
Signed-off-by: Andrew Thornton <[email protected]>
1 parent 0924f42 commit e0e045a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

services/auth/source/smtp/auth.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ func Authenticate(a smtp.Auth, source *Source) error {
6565
}
6666
defer conn.Close()
6767

68-
isSecureConn := source.ForceSMTPS || source.Port == 465
69-
if isSecureConn {
68+
if source.UseTLS() {
7069
conn = tls.Client(conn, tlsConfig)
7170
}
7271

@@ -92,7 +91,7 @@ func Authenticate(a smtp.Auth, source *Source) error {
9291

9392
// If not using SMTPS, always use STARTTLS if available
9493
hasStartTLS, _ := client.Extension("STARTTLS")
95-
if !isSecureConn && hasStartTLS {
94+
if !source.UseTLS() && hasStartTLS {
9695
if err = client.StartTLS(tlsConfig); err != nil {
9796
return fmt.Errorf("failed to start StartTLS: %v", err)
9897
}

0 commit comments

Comments
 (0)