+2011-06-22 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * mail/smtpmail.el (smtpmail-try-auth-methods): If the user has
+ stored a user name, then query for the password first, instead of
+ waiting for SMTP to give an error message and the trying again.
+
2011-06-22 Lawrence Mitchell <wence@gmx.li>
* net/browse-url.el (browse-url-xdg-open): Use 0, rather than nil
(defun smtpmail-try-auth-methods (process supported-extensions host port
&optional ask-for-password)
+ (setq port
+ (if port
+ (format "%s" port)
+ "smtp"))
(let* ((mechs (cdr-safe (assoc 'auth supported-extensions)))
(mech (car (smtpmail-intersection mechs smtpmail-auth-supported)))
(auth-source-creation-prompts
(auth-source-search
:max 1
:host host
- :port (if port
- (format "%s" port)
- "smtp")
+ :port port
:require (and ask-for-password
'(:user :secret))
:create ask-for-password)))
(save-function (and ask-for-password
(plist-get auth-info :save-function)))
ret)
+ (when (and user
+ (not password))
+ ;; The user has stored the user name, but not the password, so
+ ;; ask for the password, even if we're not forcing that through
+ ;; `ask-for-password'.
+ (setq auth-info
+ (car
+ (auth-source-search
+ :max 1
+ :host host
+ :port port
+ :require '(:user :secret)
+ :create t))
+ password (plist-get auth-info :secret)))
(when (functionp password)
(setq password (funcall password)))
(cond