From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: fisal@zephra.com (Fidel Salas) Newsgroups: gmane.emacs.bugs Subject: Re: make smtpmail.el use the new netrc.el file Date: 7 May 2002 12:45:28 -0700 Organization: http://groups.google.com/ Sender: bug-gnu-emacs-admin@gnu.org Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1020800899 16197 127.0.0.1 (7 May 2002 19:48:19 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 7 May 2002 19:48:19 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 175Awc-0004D8-00 for ; Tue, 07 May 2002 21:48:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 175Awh-0008DM-00; Tue, 07 May 2002 15:48:23 -0400 Original-Received: from mailbox4.ucsd.edu ([132.239.1.56]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 175Aty-00087B-00 for ; Tue, 07 May 2002 15:45:34 -0400 Original-Received: from smtp3.google.com (smtp3.google.com [216.239.33.28]) by mailbox4.ucsd.edu (8.12.1/8.12.1) with ESMTP id g47JjTAJ020819 for ; Tue, 7 May 2002 12:45:30 -0700 (PDT) Original-Received: from sjins2.sj.google.com (proxy.google.com [216.239.35.5]) by smtp3.google.com with ESMTP id MAA02821 for ; Tue, 7 May 2002 12:45:29 -0700 Original-Received: from sjmm36.sj.google.com (sjmm36.prod.google.com [10.6.39.36]) by sjins2.sj.google.com (8.9.3/8.9.3) with ESMTP id MAA30830 for ; Tue, 7 May 2002 12:45:27 -0700 Original-Received: (from news@localhost) by sjmm36.sj.google.com (8.9.3/8.9.3) id MAA19208 for gnu-emacs-bug@moderators.isc.org; Tue, 7 May 2002 12:45:28 -0700 Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 125 Original-NNTP-Posting-Host: 64.175.41.109 Original-X-Trace: posting.google.com 1020800728 19207 127.0.0.1 (7 May 2002 19:45:28 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 7 May 2002 19:45:28 GMT Errors-To: bug-gnu-emacs-admin@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.bugs:1222 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:1222 I am using the latest smtpmail.el and netrc.el code. After compiling netrc and then smtpmail, I got the following error: Compiling file /usr/local/share/emacs/21.1/lisp/mail/smtpmail.el at Mon May 6 17:59:04 2002 ** The following functions are not known to be defined: netrc-machine, netrc-get I got around this by insertin the following lines in smtpmail before compiling: (autoload 'netrc-machine "netrc") (autoload 'netrc-get "netrc") I have a problem when I attempt to send mail. I have set smtpmail-auth-credentials to: "my smtp host" 25 "my username nil When I try to send mail, I get prompted for my password but then get the following error message: 'smtpmail-try-auth-methods: Mechanism nil not implemented' Any help is appreciated. Thanks Fidel jas@extundo.com (Simon Josefsson) wrote in message news:... > This patch makes smtpmail.el take advantage of the new netrc.el stuff. > > I bumped :version on the variable to "21.3". Is this correct? I > wasn't sure about that. > > I am sending this message with SMTP authentication using ~/.authinfo, > but I also tested the old `smtpmail-auth-credentials' as well. Not > tested by anyone but me though. Ted, if you can/want, please test > it. (Ted, netrc.el has been added to Emacs, XEmacs and Oort Gnus now.) > > 2002-04-24 Simon Josefsson > > * mail/smtpmail.el (smtpmail-auth-credentials): Support netrc > files as well. > (smtpmail-try-auth-methods): Support netrc data. > (netrc-parse): Autoload netrc. > > --- smtpmail.el.~1.38.~ Wed Apr 24 21:13:38 2002 > +++ smtpmail.el Wed Apr 24 21:26:11 2002 > @@ -40,7 +40,7 @@ > ;;(setq smtpmail-local-domain "YOUR DOMAIN NAME") > ;;(setq smtpmail-sendto-domain "YOUR DOMAIN NAME") > ;;(setq smtpmail-debug-info t) ; only to debug problems > -;;(setq smtpmail-auth-credentials > +;;(setq smtpmail-auth-credentials ; or use ~/.authinfo > ;; '(("YOUR SMTP HOST" 25 "username" "password"))) > ;;(setq smtpmail-starttls-credentials > ;; '(("YOUR SMTP HOST" 25 "~/.my_smtp_tls.key" "~/.my_smtp_tls.cert"))) > @@ -73,6 +73,7 @@ > (autoload 'message-make-date "message") > (autoload 'message-make-message-id "message") > (autoload 'rfc2104-hash "rfc2104") > +(autoload 'netrc-parse "netrc") > > ;;; > (defgroup smtpmail nil > @@ -150,19 +151,21 @@ > :type 'directory > :group 'smtpmail) > > -(defcustom smtpmail-auth-credentials '(("" 25 "" nil)) > - "Specify username and password for servers. > -It is a list of four-element lists that contain, in order, > +(defcustom smtpmail-auth-credentials "~/.authinfo" > + "Specify username and password for servers, directly or via .netrc file. > +This variable can either be a filename pointing to a file in netrc(5) > +format, or list of four-element lists that contain, in order, > `servername' (a string), `port' (an integer), `user' (a string) and > -`password' (a string, or nil to query the user when needed). > -If you need to enter a `realm' too, add it to the user string, so that > -it looks like `user@realm'." > - :type '(repeat (list (string :tag "Server") > +`password' (a string, or nil to query the user when needed). If you > +need to enter a `realm' too, add it to the user string, so that it > +looks like `user@realm'." > + :type '(choice file > + (repeat (list (string :tag "Server") > (integer :tag "Port") > (string :tag "Username") > (choice (const :tag "Query when needed" nil) > - (string :tag "Password")))) > - :version "21.1" > + (string :tag "Password"))))) > + :version "21.3" > :group 'smtpmail) > > (defcustom smtpmail-starttls-credentials '(("" 25 "" "")) > @@ -460,7 +467,16 @@ > (defun smtpmail-try-auth-methods (process supported-extensions host port) > (let* ((mechs (cdr-safe (assoc 'auth supported-extensions))) > (mech (car (smtpmail-intersection smtpmail-auth-supported mechs))) > - (cred (smtpmail-find-credentials smtpmail-auth-credentials host port)) > + (cred (if (stringp smtpmail-auth-credentials) > + (let* ((netrc (netrc-parse smtpmail-auth-credentials)) > + (hostentry (netrc-machine > + netrc host (format "%s" (or port "smtp")) > + "smtp"))) > + (list host port > + (netrc-get hostentry "login") > + (netrc-get hostentry "password"))) > + (smtpmail-find-credentials > + smtpmail-auth-credentials host port))) > (passwd (when cred > (or (smtpmail-cred-passwd cred) > (read-passwd > @@ -507,7 +523,8 @@ > (t > (error "Mechanism %s not implemented" mech))) > ;; Remember the password. > - (unless (smtpmail-cred-passwd cred) > + (when (and (not (stringp smtpmail-auth-credentials)) > + (null (smtpmail-cred-passwd cred))) > (setcar (cdr (cdr (cdr cred))) passwd))))) > > (defun smtpmail-via-smtp (recipient smtpmail-text-buffer)