Skip to content

Commit

Permalink
Fix unexported smtp#StartTLS() method with go-smtp >= 0.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Apr 16, 2024
1 parent 5ef7627 commit 980348d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions cmd/channel/email/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func (ch *Email) Send(reversePath string, recipients []string, msg []byte) error

if ch.Encryption == EncryptionTLS {
client, err = smtp.DialTLS(ch.GetServer(), nil)
} else if ch.Encryption == EncryptionStartTLS {
client, err = smtp.DialStartTLS(ch.GetServer(), nil)
} else {
client, err = smtp.Dial(ch.GetServer())
}
Expand All @@ -76,12 +78,6 @@ func (ch *Email) Send(reversePath string, recipients []string, msg []byte) error
}
defer func() { _ = client.Close() }()

if ch.Encryption == EncryptionStartTLS {
if err = client.StartTLS(nil); err != nil {
return err
}
}

if ch.Password != "" {
if err = client.Auth(sasl.NewPlainClient("", ch.User, ch.Password)); err != nil {
return err
Expand Down

0 comments on commit 980348d

Please sign in to comment.