From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/80590 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.gnus.general Subject: smtpmail authentication again Date: Thu, 17 Nov 2011 17:06:21 +0100 Organization: aich tea tea pea dicky riley dot net Message-ID: Reply-To: ding@gnus.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1321548298 14390 80.91.229.12 (17 Nov 2011 16:44:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 17 Nov 2011 16:44:58 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M28873@lists.math.uh.edu Thu Nov 17 17:44:53 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RR54v-0001QS-WB for ding-account@gmane.org; Thu, 17 Nov 2011 17:44:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1RR53D-0001bU-Up; Thu, 17 Nov 2011 10:42:59 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1RR4XU-0001Sh-GM for ding@lists.math.uh.edu; Thu, 17 Nov 2011 10:10:12 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1RR4XS-0002MT-5v for ding@lists.math.uh.edu; Thu, 17 Nov 2011 10:10:11 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1RR4XO-000148-17 for ding@gnus.org; Thu, 17 Nov 2011 17:10:06 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RR4XN-0005an-LB for ding@gnus.org; Thu, 17 Nov 2011 17:10:05 +0100 Original-Received: from 85.183.18.158 ([85.183.18.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 17 Nov 2011 17:10:05 +0100 Original-Received: from rileyrg by 85.183.18.158 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 17 Nov 2011 17:10:05 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-Lines: 94 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 85.183.18.158 Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux) Cancel-Lock: sha1:3wl8Q77IH33eJN11Ouh9/DyGqPc= X-Spam-Score: -4.0 (----) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:80590 Archived-At: I have more than one gmail account. I want to use smtpmail but with account specific authinfo details. As usual I have something of the form ,---- | (add-to-list 'gnus-secondary-select-methods | '(nnimap "acc1" | (nnir-search-engine imap) | (nnimap-address "imap.gmail.com") | )) | (add-to-list 'gnus-secondary-select-methods | '(nnimap "acc2" | (nnir-search-engine imap) | (nnimap-address "imap.gmail.com") | )) `---- reading mail isnt an issue: a .authinfo.gpg extract is: ,---- | machine acc1 login id1 password **** | machine acc2 login id2 password **** `---- There are numerous complex hacks/howtos out there which swap smtp authinfo based on from address etc, but with all the recent changes I am wondering if its now built in somehow? Any example of using smtp from gnus directly using more than one smtp server appreciated. One working but horrendously complicated way is using something like:- ,---- | ;; (defun set-smtp (mech server port user password) | ;; "Set related SMTP variables for supplied parameters." | ;; (setq smtpmail-smtp-server server | ;; smtpmail-smtp-service port | ;; smtpmail-auth-credentials (list (list server port user password)) | ;; smtpmail-auth-supported (list mech) | ;; smtpmail-starttls-credentials nil) | ;; (message "Setting SMTP server to `%s:%s' for user `%s'." | ;; server port user)) | | ;; (defun set-smtp-ssl (server port user password &optional key cert) | ;; "Set related SMTP and SSL variables for supplied parameters." | ;; (setq starttls-use-gnutls t | ;; starttls-gnutls-program "gnutls-cli" | ;; ;; TODO: Add this to the server parameters | ;; ;; starttls-extra-arguments nil | ;; smtpmail-smtp-server server | ;; smtpmail-smtp-service port | ;; smtpmail-auth-credentials (list (list server port user password)) | ;; smtpmail-starttls-credentials (list (list server port key cert))) | ;; (message | ;; "Setting SMTP server to `%s:%s' for user `%s'. (SSL enabled.)" | ;; server port user)) | | ;; (defun change-smtp () | ;; "Change the SMTP server according to the current from line." | ;; (interactive) | ;; (save-excursion | ;; (loop with from = (save-restriction | ;; (message-narrow-to-headers) | ;; (message-fetch-field "from")) | ;; for (auth-mech address . auth-spec) in smtp-accounts | ;; when (string-match address from) | ;; do (cond | ;; ((memq auth-mech '(cram-md5 plain login)) | ;; (return (apply 'set-smtp (cons auth-mech auth-spec)))) | ;; ((eql auth-mech 'ssl) | ;; (return (apply 'set-smtp-ssl auth-spec))) | ;; (t (error "Unrecognized SMTP auth. mechanism: `%s'." auth-mech))) | ;; finally (error "Cannot infer SMTP information.")))) | | ;; (setq message-sendmail-envelope-from 'header) | ;; (add-hook 'message-send-hook 'change-smtp) | | ;; (setq smtp-accounts '( | ;; (ssl "riley" "smtp.gmail.com" "587" | ;; "rileyrg@gmail.com" nil) | ;; (ssl "shamrock" "smtp.gmail.com" "587" | ;; "shamrockirishbar@gmail.com" nil) | ;; )) `---- Could it be a lot easier now. Im using the gnus what comes with bzr emacs 24. regards r.