OAuth2: don't send the "*" command to cancel authentication

XOAUTH2 does not follow the SMTP AUTH RFC
This commit is contained in:
Nicola Murino 2023-05-29 18:21:24 +02:00
parent 8673addaf0
commit 2a67b397c7

View file

@ -234,8 +234,10 @@ func (c *Client) Auth(a Auth) error {
resp, err = a.Next(msg, code == 334)
}
if err != nil {
// abort the AUTH
_, _, _ = c.cmd(501, "*")
if mech != "XOAUTH2" {
// abort the AUTH. Not required for XOAUTH2
_, _, _ = c.cmd(501, "*")
}
_ = c.Quit()
break
}