From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/76561 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.gnus.general Subject: Re: smtp credential, multiple smtp, posting styles and smtpmail Date: Fri, 11 Feb 2011 00:15:30 +0100 Organization: aich tea tea pea dicky riley dot net Message-ID: References: <87ipwsw8j9.fsf@keller.adm.naquadah.org> <87ipws86pn.fsf@netarch.haselwarter.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1297379779 28446 80.91.229.12 (10 Feb 2011 23:16:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 10 Feb 2011 23:16:19 +0000 (UTC) Cc: ding@gnus.org To: Philipp Haselwarter Original-X-From: ding-owner+M24907@lists.math.uh.edu Fri Feb 11 00:16:14 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 1PnfkD-0004LB-UI for ding-account@gmane.org; Fri, 11 Feb 2011 00:16:14 +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 1Pnfjn-0003aU-UB; Thu, 10 Feb 2011 17:15:47 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Pnfjl-0003aD-U5 for ding@lists.math.uh.edu; Thu, 10 Feb 2011 17:15:45 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1Pnfjk-0007hW-9a for ding@lists.math.uh.edu; Thu, 10 Feb 2011 17:15:45 -0600 Original-Received: from [85.183.18.158] (helo=asus1015pem) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1Pnfjj-0004BE-Cb for ding@gnus.org; Fri, 11 Feb 2011 00:15:43 +0100 Original-Received: from shamrock by asus1015pem with local (Exim 4.72) (envelope-from ) id 1Pnfjh-0001Na-UN; Fri, 11 Feb 2011 00:15:41 +0100 In-Reply-To: <87ipws86pn.fsf@netarch.haselwarter.org> (Philipp Haselwarter's message of "Thu, 10 Feb 2011 12:33:24 +0100") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) X-Spam-Score: 1.7 (+) X-Spam-Report: SpamAssassin (3.3.1 2010-03-16) analysis follows Bayesian score: 0.0000 Ham tokens: 0.000-1651--4017h-0s--0d--H*u:Emacs, 0.000-1588--3864h-0s--0d--H*u:Gnus, 0.000-1534--3732h-0s--0d--H*u:linux, 0.000-1534--3732h-0s--0d--H*UA:linux, 0.000-1478--3594h-0s--0d--H*u:gnu Spam tokens: Autolearn status: no 0.0 FSL_HELO_NON_FQDN_1 FSL_HELO_NON_FQDN_1 0.0 FREEMAIL_FROM Sender email is freemail (rileyrg[at]googlemail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain 0.0 HELO_NO_DOMAIN Relay reports its domain incorrectly 1.9 FREEMAIL_REPLY From and body contain different freemails 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:76561 Archived-At: Success! With a slight variation. I used a "from" in my gnus-posting-styles rather than an "address". ,---- | (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) | )) | | (setq gnus-posting-styles `((".*" | (from "Richard Riley ") | (eval(setq gnushush-user-agent-header (quote real))) | (signature-file "~/.emacs.d/.sigs/rgr.sig") | (eval (setq mml2015-signers '("AB23BE58"))) | (organization "aich tea tea pea dicky riley dot net")))) | | (add-to-list `gnus-posting-styles `(,(rx(or "shamrock")) | (from "The Shamrock Irish Bar") | (eval (setq mml2015-signers '("945a4967"))) | (organization "http://www.shamrockirishbar.com") | (signature-file "~/.emacs.d/.sigs/s.sig")) t) `---- And the corresponding entry in my authinfo.gpg ,---- | machine riley login rileyrg password ********* | machine shamrockpub login shamrockirishbar password ******** `---- great. I'm not sure, because of my hazy elisp, how its matching against the authinfo but it does. And the smtp-accounts allow same smtp server with different authentication credentials. thanks r.