* mail/smtpmail.el (smtpmail-via-smtp): Make sure we don't send
QUIT twice.
+ (smtpmail-try-auth-methods): Require user name and password from
+ auth-source.
2011-06-22 Martin Rudalics <rudalics@gmx.at>
when (string-match (concat "^" auth-source-magic)
(symbol-name sym))
;; remove that key
- do (password-cache-remove (symbol-name sym))))
+ do (password-cache-remove (symbol-name sym)))
+ (setq auth-source-netrc-cache nil))
(defun auth-source-remember (spec found)
"Remember FOUND search results for SPEC."
;; we know (because of an assertion in auth-source-search) that the
;; :create parameter is either t or a list (which includes nil)
(create-extra (if (eq t create) nil create))
+ (current-data (car (auth-source-search :max 1
+ :host host
+ :port port)))
(required (append base-required create-extra))
(file (oref backend source))
(add "")
(dolist (r required)
(let* ((data (aget valist r))
;; take the first element if the data is a list
- (data (auth-source-netrc-element-or-first data))
+ (data (or (auth-source-netrc-element-or-first data)
+ (plist-get current-data
+ (intern (format ":%s" r) obarray))))
;; this is the default to be offered
(given-default (aget auth-source-creation-defaults r))
;; the default supplementals are simple:
'((user . "SMTP user at %h: ")
(secret . "SMTP password for %u@%h: ")))
(auth-info (car
- (auth-source-search :max 1
- :host host
- :port (if port
- (format "%s" port)
- "smtp")
- :create ask-for-password)))
+ (auth-source-search
+ :max 1
+ :host host
+ :port (if port
+ (format "%s" port)
+ "smtp")
+ :require (and ask-for-password
+ '(:user :secret))
+ :create ask-for-password)))
(user (plist-get auth-info :user))
(password (plist-get auth-info :secret))
(save-function (and ask-for-password