Subject: bug#35682: 27.0.50; Weird failure to authenticate in smtpmail

From: Robert Pluim <[email-masked]>
Date: Sat, 11 May 2019 12:16:09 +0200

>>>>> On Fri, 10 May 2019 19:26:42 -0400, Stefan Monnier <[email-masked]> said:

    Stefan> Package: Emacs Version: 27.0.50

    Stefan> Recently my SMTP server was updated and I started to get
    Stefan> authentication errors when sending email.  More
    Stefan> specifically, when sending from message-mode, I get the
    Stefan> following error:

    Stefan>     Debugger entered--Lisp error: (error "Sending failed:
    Stefan> 453 4.7.1 <[email-masked]>: Sender address
    Stefan> rejected: not logged in") signal(error ("Sending failed:
    Stefan> 453 4.7.1 <[email-masked]>: Sender address
    Stefan> rejected: not logged in")) error("Sending failed: 453
    Stefan> 4.7.1 <[email-masked]>: Sender address rejected:
    Stefan> not logged in") smtpmail-send-it()
    Stefan> message-smtpmail-send-it() message-multi-smtp-send-mail()
    Stefan> message-send-mail(nil) message-send-via-mail(nil)
    Stefan> message-send(nil) message-send-and-exit(nil)
    Stefan> funcall-interactively(message-send-and-exit nil)
    Stefan> call-interactively(message-send-and-exit nil nil)
    Stefan> command-execute(message-send-and-exit)

    Stefan> My smtpmail-related settings are:

    Stefan>     (setq send-mail-function #'smtpmail-send-it) (setq
    Stefan> smtpmail-smtp-service 587) (setq smtpmail-smtp-server
    Stefan> <mailserver>) (setq smtpmail-smtp-user
    Stefan> "[email-masked]")

Iʼd encourage 465 rather than 587, but that might not work for you.

    Stefan> and until recently this worked fine, prompting me for a
    Stefan> password and authenticating with it.  But now, I don't get
    Stefan> prompted for a password any more.

    Stefan> I can work around the problem with the patch below, but I
    
ENOPATCH (but I can imagine what it looks like)

    Stefan> have no idea what other undesired effects it should have.
    Stefan> Apparently the code catches the error 530 and treats it as
    Stefan> a request to perform authentication, so maybe the origin
    Stefan> of the problem is that the mail server now returns 453
    Stefan> instead of 530?  Should Emacs handle 453 like it handles
    Stefan> 530?  Should I report the problem to my SMTP admin
    Stefan> instead?

Talk to your SMTP admin, they've messed something up. 453 is basically
'go away, Iʼm not accepting messages'. 530 is 'go away, you haven't
authenticated yourself'.

Iʼm assuming you donʼt have an authinfo entry for this user? If I
remember correctly, when you do have such an entry (including a
passwordless one) smtpmail.el will proactively authenticate, rather
than wait for a rejection. (see smtpmail-try-auth-methods)

Robert