Xiyue Deng writes: > Hi Robert, > > Robert Pluim writes: > >>>>>>> On Thu, 15 May 2025 00:17:02 -0700, Xiyue Deng said: >> >> Xiyue> Thanks for the insights! I managed to reproduce the issue, and during >> Xiyue> debugging I got the list from the reply as Anush mentioned. Turned out >> Xiyue> that the return code was 334 server challenge[1], so it was waiting for >> Xiyue> the correct user and password. Sometimes this was directly considered >> Xiyue> authentication unsuccessful for Gmail[2]. `smtpmail-ok-p' considers a >> Xiyue> return code less than 400 as successful, and only has challenge handling >> Xiyue> implemented in cram-md5. As we should be providing the correct >> Xiyue> credentials directly in xoauth2, 334 is effectively a failure. >> >> Xiyue> Maybe in `smtpmail-try-auth-method' for xoauth2, if we see return code >> Xiyue> 334, we should change the return value to "535 5.7.8 Authentication >> Xiyue> credentials invalid". Would like to see whether the Emacs maintainers >> Xiyue> this is a good idea. >> >> Itʼs either that, or change `smtpmail-ok-p' to accept a second >> optional parameter for which codes to accept for success, which seems >> like overkill here. >> > > In this case it's more like which codes not to accept (334), but I agree > `smtpmail-ok-p' is probably the wrong place to handle that. > > I'll work on a patch for `smtpmail-try-auth-method' later. > A draft patch is attached, please take a look. -- Regards, Xiyue Deng