From 5e3ebcc1a6f5f882af6eb5d074e35147f0895f6a Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 24 Oct 2024 10:12:57 +0200 Subject: [PATCH] Remove redundant connection check in auth function 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. --- client.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/client.go b/client.go index af56afc..55280b6 100644 --- a/client.go +++ b/client.go @@ -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 {