diff --git a/client_119.go b/client_119.go index 7de5d59..0b05061 100644 --- a/client_119.go +++ b/client_119.go @@ -11,6 +11,9 @@ import "errors" // Send sends out the mail message func (c *Client) Send(messages ...*Msg) error { + c.mutex.Lock() + defer c.mutex.Unlock() + if err := c.checkConn(); err != nil { return &SendError{Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err)} } diff --git a/client_120.go b/client_120.go index 729069b..5bb291d 100644 --- a/client_120.go +++ b/client_120.go @@ -15,6 +15,7 @@ import ( func (c *Client) Send(messages ...*Msg) (returnErr error) { c.mutex.Lock() defer c.mutex.Unlock() + if err := c.checkConn(); err != nil { returnErr = &SendError{Reason: ErrConnCheck, errlist: []error{err}, isTemp: isTempError(err)} return