From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/76518 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.gnus.general Subject: Re: Multiple SMTP servers with Gnus? Date: Wed, 09 Feb 2011 18:46:59 +0100 Organization: aich tea tea pea dicky riley dot net Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1297273652 4855 80.91.229.12 (9 Feb 2011 17:47:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 9 Feb 2011 17:47:32 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M24865@lists.math.uh.edu Wed Feb 09 18:47:27 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 1PnE8U-00089x-8S for ding-account@gmane.org; Wed, 09 Feb 2011 18:47:26 +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 1PnE8T-00042k-5n; Wed, 09 Feb 2011 11:47:25 -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 1PnE8Q-00040s-2S for ding@lists.math.uh.edu; Wed, 09 Feb 2011 11:47:22 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PnE8N-0000Ah-IY for ding@lists.math.uh.edu; Wed, 09 Feb 2011 11:47:21 -0600 Original-Received: from mail-bw0-f44.google.com ([209.85.214.44]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1PnE8M-0000Fs-QH for ding@gnus.org; Wed, 09 Feb 2011 18:47:18 +0100 Original-Received: by mail-bw0-f44.google.com with SMTP id 12so1142837bwz.17 for ; Wed, 09 Feb 2011 09:47:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:from:to:subject:in-reply-to:date:organization :message-id:references:user-agent:mime-version:content-type :content-transfer-encoding; bh=0NppjEpmrf46Q3PF0qamSzUKTm5An6aAfuFnwfOT+II=; b=pmSiM5xi4LfEOpw7vqAcUWl9mk7qYVH262tuo8ByeE1BHCBEVUTgiwMNaIPBcrq8za 3ytrNEL0fAq95k4AOCgtXF334VI+F1YFzoMEkEr6I1pJoR1pAQw1CToT4Zqk5JL57xkF C52yCzOXMEhr5lGAS+d9rlrJa2umHs0AZnwnY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:subject:in-reply-to:date:organization:message-id:references :user-agent:mime-version:content-type:content-transfer-encoding; b=CxrTEAdKBmdkO/1nx7vK4PXzONg3VPrS8dTrbBcZ/c46shVSkkWUATrUBn3PL8KvUb xvTBiFdgH/i3pT/XdR4TUeOHtnJ7ujyiDZNMPYKElMdadIATDs/L/yid1cMMULlVRGR8 PCCxaKeZnKE1USXu8UtSGsmeMDp2hscGRf+yY= Original-Received: by 10.204.117.10 with SMTP id o10mr19690020bkq.10.1297273638516; Wed, 09 Feb 2011 09:47:18 -0800 (PST) Original-Received: from localhost ([85.183.18.158]) by mx.google.com with ESMTPS id f20sm379779bkf.4.2011.02.09.09.47.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 09 Feb 2011 09:47:17 -0800 (PST) In-Reply-To: (Robert Pluim's message of "Wed, 09 Feb 2011 18:39:21 +0100") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) X-Spam-Score: -3.0 (---) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:76518 Archived-At: Robert Pluim writes: > Hi, > > I currently have one SMTP server I talk to with Gnus, and another > account with a web-mail interface that also supports SMTP. I'm > considering just using Gnus for both, but I was wondering what the > canonical method was for configuring this? gnus-posting-styles would > theoretically fit, but I can't see any way to set any of the smtpmail > variables in a posting style. > > Thanks > > Robert > My preferred way is msmtp. There is some junk in the msmtp-change-smtp function below but its all so hairy to set up I wont touch it anymore ;) It bases the msmtp account to use on the from address. Hope it suits. ,---- | msmtp-name-list is a variable defined in `rgr-misc.gpg'. | Its value is | ("root" "richardriley" "riley" "shamrock") `---- ,---- | ;; Select the correct smtp server based on the from address. | (defun msmtp-account (&optional def) | (let* ((from | (save-restriction | (message-narrow-to-headers) | (message-fetch-field "From"))) | (account (if from (catch 'match | (dolist (element msmtp-name-list) | ;; (message (format "smpt chosen is %s" = element)) | (when (string-match (format ".*%s.*" ele= ment) from) | (throw 'match element)))) nil))) | (if account account (if def def "default")))) |=20 | (defun msmtp-change-smtp () | (setq sendmail-program "/usr/bin/msmtp") | (setq smtpmail-starttls-credentials '(("smtp.googlemail.com" 587 nil = nil))) | (setq smtpmail-smtp-server "smtp.googlemail.com") | (setq message-sendmail-envelope-from 'header) | (if (message-mail-p) | (setq message-sendmail-extra-arguments (list "-a" (msmtp-account = "default"))))) | (add-hook 'message-send-hook 'msmtp-change-smtp) |=20 |=20=20 `---- Where my .msmtprc file is of the form ,---- | defaults | host smtp.gmail.com | port 587 | auth on | tls on | tls_certcheck off | logfile /tmp/msmtp.log |=20 | account riley | user rileyrg@googlemail.com | password ***** | from rileyrg@googlemail.com |=20 | account richardriley | host smtp.richardriley.net | port 25 | user rgr | password ************** | from rgr@richardriley.com |=20 | account shamrock | port 25 | user shamrockirishbar | password ******** | from shamrock@shamrockirishbar.com |=20 `---- --=20 =E2=98=98 http://www.shamrockirishbar.com, http://splash-of-open-sauce.blog= spot.com/ http://www.richardriley.net