diff --git a/client.go b/client.go index 48548ce..6557913 100644 --- a/client.go +++ b/client.go @@ -801,6 +801,9 @@ func (c *Client) auth() error { // sendSingleMsg sends out a single message and returns an error if the transmission/delivery fails. // It is invoked by the public Send methods func (c *Client) sendSingleMsg(message *Msg) error { + c.mutex.Lock() + defer c.mutex.Unlock() + if message.encoding == NoEncoding { if ok, _ := c.smtpClient.Extension("8BITMIME"); !ok { return &SendError{Reason: ErrNoUnencoded, isTemp: false, affectedMsg: message} diff --git a/client_119.go b/client_119.go index 0b05061..7de5d59 100644 --- a/client_119.go +++ b/client_119.go @@ -11,9 +11,6 @@ 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 5bb291d..4f82aa7 100644 --- a/client_120.go +++ b/client_120.go @@ -13,9 +13,6 @@ import ( // Send sends out the mail message 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