summaryrefslogtreecommitdiff
path: root/lisp/mail/smtpmail.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/mail/smtpmail.el')
-rw-r--r--lisp/mail/smtpmail.el45
1 files changed, 23 insertions, 22 deletions
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 33458178a51..45b25b55301 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -171,7 +171,7 @@ attempt."
"The number of times smtpmail will retry sending when getting transient errors.
These are errors with a code of 4xx from the SMTP server, which
mean \"try again\"."
- :type 'integer
+ :type 'natnum
:version "27.1")
(defcustom smtpmail-store-queue-variables nil
@@ -342,8 +342,6 @@ for `smtpmail-try-auth-method'.")
;; Insert an extra newline if we need it to work around
;; Sun's bug that swallows newlines.
(goto-char (1+ delimline))
- (if (eval mail-mailer-swallows-blank-line t)
- (newline))
;; Find and handle any Fcc fields.
(goto-char (point-min))
(if (re-search-forward "^Fcc:" delimline t)
@@ -552,13 +550,10 @@ for `smtpmail-try-auth-method'.")
:require (and ask-for-password
'(:user :secret))
:create ask-for-password)))
- (mech (or (plist-get auth-info :smtp-auth) (car mechs)))
(user (plist-get auth-info :user))
- (password (plist-get auth-info :secret))
+ (password (auth-info-password auth-info))
(save-function (and ask-for-password
(plist-get auth-info :save-function))))
- (when (functionp password)
- (setq password (funcall password)))
(when (and user
(not password))
;; The user has stored the user name, but not the password, so
@@ -573,21 +568,27 @@ for `smtpmail-try-auth-method'.")
:user smtpmail-smtp-user
:require '(:user :secret)
:create t))
- password (plist-get auth-info :secret)))
- (when (functionp password)
- (setq password (funcall password)))
- (let ((result (catch 'done
- (if (and mech user password)
- (smtpmail-try-auth-method process mech user password)
- ;; No mechanism, or no credentials.
- mech))))
- (if (stringp result)
- (progn
- (auth-source-forget+ :host host :port port)
- (throw 'done result))
- (when save-function
- (funcall save-function))
- result))))
+ password (auth-info-password auth-info)))
+ (let ((mechs (or (ensure-list (plist-get auth-info :smtp-auth))
+ mechs))
+ (result ""))
+ (when (and mechs user password)
+ (while (and mechs
+ (stringp result))
+ (setq result (catch 'done
+ (smtpmail-try-auth-method
+ process (pop mechs) user password))))
+ ;; A string result is an error.
+ (if (stringp result)
+ (progn
+ ;; All methods failed.
+ ;; Forget the credentials.
+ (auth-source-forget+ :host host :port port)
+ (throw 'done result))
+ ;; Success.
+ (when save-function
+ (funcall save-function))
+ result)))))
(cl-defgeneric smtpmail-try-auth-method (_process mech _user _password)
"Perform authentication of type MECH for USER with PASSWORD.