Skip to content

Commit

Permalink
Remove redundant connection check in auth function
Browse files Browse the repository at this point in the history
The checkConn call in the auth function was redundant because the connection is already managed appropriately elsewhere. Removing this unnecessary check simplifies the code and avoids potential duplication of error handling.
  • Loading branch information
wneessen committed Oct 24, 2024
1 parent 040289c commit 5e3ebcc
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1094,10 +1094,6 @@ func (c *Client) DialAndSendWithContext(ctx context.Context, messages ...*Msg) e
// - An error if the connection check fails, if no supported authentication method is found,
// or if the authentication process fails.
func (c *Client) auth() error {
if err := c.checkConn(); err != nil {
return fmt.Errorf("failed to authenticate: %w", err)
}

if c.smtpAuth == nil && c.smtpAuthType != SMTPAuthNoAuth {
hasSMTPAuth, smtpAuthType := c.smtpClient.Extension("AUTH")
if !hasSMTPAuth {
Expand Down

0 comments on commit 5e3ebcc

Please sign in to comment.