Skip to content

Commit

Permalink
RSET connection every time before re-using in the pool.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Dec 23, 2023
1 parent 3c7a8e7 commit 6f93552
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ func (p *Pool) returnConn(c *conn, lastErr error) (err error) {
}
}

// Always RSET (SMTP) the connection bfeore reusing it as some servers
// throw "sender already specified", or "commands out of sequence" errors.
if err := c.conn.Reset(); err != nil {
return err
}

select {
case p.conns <- c:
return nil
Expand Down

0 comments on commit 6f93552

Please sign in to comment.