From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/76816 Path: news.gmane.org!not-for-mail From: Johnny Newsgroups: gmane.emacs.gnus.general Subject: Re: Multiple SMTP servers with Gnus? Date: Wed, 16 Feb 2011 16:12:01 +0000 Message-ID: <87d3msarhq.fsf@gmx.co.uk> References: <87k4h99d3l.fsf@gmail.com> <878vxjic8e.fsf@gnus.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1297872769 19546 80.91.229.12 (16 Feb 2011 16:12:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 16 Feb 2011 16:12:49 +0000 (UTC) Cc: ding@gnus.org To: Richard Riley Original-X-From: ding-owner+M25155@lists.math.uh.edu Wed Feb 16 17:12:44 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 1Ppjzg-0002Pd-50 for ding-account@gmane.org; Wed, 16 Feb 2011 17:12:44 +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 1Ppjz7-0007wY-HP; Wed, 16 Feb 2011 10:12:09 -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 1Ppjz5-0007wH-E9 for ding@lists.math.uh.edu; Wed, 16 Feb 2011 10:12:07 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1Ppjz3-0005Vf-AY for ding@lists.math.uh.edu; Wed, 16 Feb 2011 10:12:06 -0600 Original-Received: from mailout-eu.gmx.com ([213.165.64.42]) by quimby.gnus.org with smtp (Exim 4.72) (envelope-from ) id 1Ppjz2-0004CJ-8b for ding@gnus.org; Wed, 16 Feb 2011 17:12:04 +0100 Original-Received: (qmail invoked by alias); 16 Feb 2011 16:11:57 -0000 Original-Received: from 78-86-131-176.zone2.bethere.co.uk (EHLO DeuxExMachina) [78.86.131.176] by mail.gmx.com (mp-eu004) with SMTP; 16 Feb 2011 17:11:57 +0100 X-Authenticated: #57368918 X-Provags-ID: V01U2FsdGVkX18/S/gAUI0/IzbpI3QXsxbnXJkNRAQPxkDA7sCeGW Jqh/YS5simOPDK In-Reply-To: (Richard Riley's message of "Mon, 14 Feb 2011 12:26:26 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:76816 Archived-At: Richard Riley writes: > I find this set up the best as when the code is in place all you need to > do is add to the smtp-accounts, gnus-posting-styles and the > .authinfo.gpg. Using this setup, I get queried for the SMTP-server password when sending email, even though I have added the account details to the .authinfo file: machine imap.gmx.com login yggdrasil@gmx.co.uk password gmxpass port 993 machine mail.gmx.com login yggdrasil@gmx.co.uk password gmxpass port 587 machine imap.gmail.com login j.carlsson@gmail.com password gmailpass port 993 machine smtp.gmail.com login j.carlsson@gmail.com password gmailpass port 587 What am I doing wrong as it doesn't seem to care about .authinfo? To make it work, I also had to use: (require 'cl) ;Enable the 'loop' command (setq message-send-mail-function 'smtpmail-send-it) > ,---- > | (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.")))) > | > | (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 smtp-accounts '( (ssl "gmx" "mail.gmx.com" "587" "yggdrasil@gmx.co.uk" nil) (ssl "gmail" "smtp.gmail.com" "587" "j.carlsson@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 '("********"))) > | (eval (setq user-mail-address "rgr@richardriley.net")) > | (organization "aich tea tea pea dicky riley dot net")))) (setq gnus-posting-styles `((".*" (from "Johnny ") (eval (setq user-mail-address "yggdrasil@gmx.co.uk")) ))) > | > | (add-to-list `gnus-posting-styles `(,(rx(or "shamrock")) > | (from "The Shamrock Irish Bar") > | (eval (setq user-mail-address "shamrock@shamrockirishbar.com")) > | (eval (setq mml2015-signers '("********"))) > | (organization "http://www.shamrockirishbar.com") > | (signature-file "~/.emacs.d/.sigs/s.sig")) t) (add-to-list `gnus-posting-styles `(,(rx(or "gmail")) (from "J Carlsson ") (eval (setq user-mail-address "j.carlsson@gmail.com")) ) t) > `---- Very useful functionality however to manage several email-adresses! -- Johnny