summaryrefslogtreecommitdiff
path: root/lisp/mail/smtpmail.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-02-21 17:34:51 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-02-21 17:34:51 -0500
commitf619ad4ca2ce943d53589469c010e451afab97dd (patch)
treee1b71f79518372ecab4c677ae948504450d8bf5d /lisp/mail/smtpmail.el
parenta647cb26b695a542e3a546104afdf4c7c47eb061 (diff)
parent9f8370e63f65f76887b319ab6a0368d4a332777c (diff)
downloademacs-f619ad4ca2ce943d53589469c010e451afab97dd.tar.gz
emacs-f619ad4ca2ce943d53589469c010e451afab97dd.tar.bz2
emacs-f619ad4ca2ce943d53589469c010e451afab97dd.zip
Merge from trunk
Diffstat (limited to 'lisp/mail/smtpmail.el')
-rw-r--r--lisp/mail/smtpmail.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index f726304704b..427d9d17746 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -77,7 +77,7 @@
(autoload 'netrc-machine "netrc")
(autoload 'netrc-get "netrc")
(autoload 'password-read "password-cache")
-(autoload 'auth-source-user-or-password "auth-source")
+(autoload 'auth-source-search "auth-source")
;;;
(defgroup smtpmail nil
@@ -538,10 +538,14 @@ The list is in preference order.")
(defun smtpmail-try-auth-methods (process supported-extensions host port)
(let* ((mechs (cdr-safe (assoc 'auth supported-extensions)))
(mech (car (smtpmail-intersection mechs smtpmail-auth-supported)))
- (auth-user (auth-source-user-or-password
- "login" host (or port "smtp")))
- (auth-pass (auth-source-user-or-password
- "password" host (or port "smtp")))
+ (auth-info (auth-source-search :max 1
+ :host host
+ :port (or port "smtp")))
+ (auth-user (plist-get (nth 0 auth-info) :user))
+ (auth-pass (plist-get (nth 0 auth-info) :secret))
+ (auth-pass (if (functionp auth-pass)
+ (funcall auth-pass)
+ auth-pass))
(cred (if (and auth-user auth-pass) ; try user-auth-* before netrc-*
(list host port auth-user auth-pass)
;; else, if auth-source didn't return them...