Compare commits

..

1 commit

Author SHA1 Message Date
Michael Fuchs
188386098e
Merge e56a563286 into 9ca7d24f6a 2024-11-06 10:19:17 +01:00
3 changed files with 2 additions and 11 deletions

View file

@ -996,7 +996,7 @@ func (c *Client) DialWithContext(dialCtx context.Context) error {
// Returns: // Returns:
// - An error if the disconnection fails; otherwise, returns nil. // - An error if the disconnection fails; otherwise, returns nil.
func (c *Client) Close() error { func (c *Client) Close() error {
if c.smtpClient == nil || !c.smtpClient.HasConnection() { if !c.smtpClient.HasConnection() {
return nil return nil
} }
if err := c.smtpClient.Quit(); err != nil { if err := c.smtpClient.Quit(); err != nil {

View file

@ -1647,15 +1647,6 @@ func TestClient_Close(t *testing.T) {
t.Errorf("close was supposed to fail, but didn't") t.Errorf("close was supposed to fail, but didn't")
} }
}) })
t.Run("close on a nil smtpclient should return nil", func(t *testing.T) {
client, err := NewClient(DefaultHost)
if err != nil {
t.Fatalf("failed to create new client: %s", err)
}
if err = client.Close(); err != nil {
t.Errorf("failed to close the client: %s", err)
}
})
} }
func TestClient_DialWithContext(t *testing.T) { func TestClient_DialWithContext(t *testing.T) {

2
doc.go
View file

@ -11,4 +11,4 @@ package mail
// VERSION indicates the current version of the package. It is also attached to the default user // VERSION indicates the current version of the package. It is also attached to the default user
// agent string. // agent string.
const VERSION = "0.5.2" const VERSION = "0.5.1"