From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rasmus Newsgroups: gmane.emacs.help Subject: Re: Multiple "outgoing" email accounts. Date: Mon, 10 Feb 2014 12:07:15 +0100 Message-ID: <87d2iv5iqk.fsf@gmx.us> References: <87eh3g0yro.fsf@gmail.com> <87bnykm0ja.wl%hskuhra@eumx.net> <87bnyj2946.fsf@gmail.com> <87sirumdxn.fsf@moondust.localdomain> <87txcaku5g.fsf@ericabrahamsen.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1392051382 26248 80.91.229.3 (10 Feb 2014 16:56:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Feb 2014 16:56:22 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: nljlistbox2@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Feb 10 17:56:30 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WCu9m-0006Fu-6W for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Feb 2014 17:56:30 +0100 Original-Received: from localhost ([::1]:56651 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCu9l-0005f5-Rq for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Feb 2014 11:56:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCogT-0002SY-I9 for help-gnu-emacs@gnu.org; Mon, 10 Feb 2014 06:05:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCogO-0003ax-Bb for help-gnu-emacs@gnu.org; Mon, 10 Feb 2014 06:05:53 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:64701) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCogO-0003as-1k for help-gnu-emacs@gnu.org; Mon, 10 Feb 2014 06:05:48 -0500 Original-Received: from x200s ([109.201.154.140]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MSIf1-1Vl5MX1JwR-00TVSd for ; Mon, 10 Feb 2014 12:05:46 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:hMxqdZhYtVYyuOnq35391I0vt74= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAAAAAByaaZbAAAAAmJLR0QA/4ePzL8AAAAJcEhZ cwAAAEgAAABIAEbJaz4AAAFcSURBVEjH1ZXbscMgDERTd9pQLdvHNsTMRcLIQmDj5CMzl3ESB3RY vbBf5cPx+iHAaY3DHJkAFIJoa7BFCKqV3tdfABOAPgnIMaWzZkuRDJgDPMTRb6jbsCnwWdDqu/mf Y/gqrSlT5A44/HR7bIAYbfu3Ayz5Ui/RGpRHAGu+8Zaa97Kq/iJLUpMvmn6V416hMH5wCxwNMWyB G4DyRjBpcsJroLZcBKTlDDfAmJXWQsxxh26tm429YGJZIpwHkXFDvW1xXQBsjQw9ZvZjIiKXQN9c zwrcuRzECYgsOuc8mhNA82QGsASQhtI2ajBcASz+BDApu0SNBcdTYAAYAS+gxa1NawXioFAywOJf tAKOAL0TJgXbGuduQ3v3OvQ1uLsTwGjp8TkQ+/IVTW4BzgpT0XroxNqlPECXyQrlUuFUeQDEENyL DdAa6RPABR4rMB307QslvyN++WL/v8Af4GqHu+Dr4gkAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEt MDctMjJUMTA6NTU6MzErMDI6MDD8c0dMAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDExLTA3LTIyVDEw OjU1OjMxKzAyOjAwjS7/8AAAAABJRU5ErkJggg== In-Reply-To: <87txcaku5g.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sat, 08 Feb 2014 14:14:51 +0800") X-Provags-ID: V03:K0:I5PdYH2/9u1dyjL95/TPnKYqdNDpx8CiNQmsSWMqfPyO8DWOEII yQUfcgwvU+caA3WRJlkEX0SP+VmFYq9OXbtUhXc3Ml0COTtJTQoAMXtr9Szk69vIhAR1CGP TRYNU9/IpMlxawFLmOURnFkSHQTcVPErDwnIVqomLKggL0eiqq2QjzrFT3B91af9UnsVk/Q efGCGM42MQgn9IMy4vtYw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.15.15 X-Mailman-Approved-At: Mon, 10 Feb 2014 11:56:11 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:96022 Archived-At: Eric Abrahamsen writes: > nljlistbox2@gmail.com (N. Jackson) writes: > >> "William G Gardella" writes: >>> N.B. that in emacs24, you can also specify which SMTP server to use >>> for message-mode on a per message basis with an >>> "X-Message-SMTP-Method:" header, e.g. >>> >>> X-Message-SMTP-Method: smtp smtp.foo.org 465 >>> >>> This eliminates much of the need for the setting of individual >>> smtpmail-* variables in these multiple accounts configurations for >>> message-mode MUAs like mu4e and Gnus. This technique also lets you >>> switch between use of smtpmail and use of your system's local sendmail >>> binary: >>> >>> X-Message-SMTP-Method: sendmail >>> >>> See (info "(message) Mail Variables") for more info. >> >> I've been looking at using this header for in my set up for multiple >> email accounts and I find myself with questions that I haven't found the >> answers to yet in the documentation: >> >> !. Does the header get removed before the mail is sent? >> >> 2. Can one omit the port number and leave that to be retrieved from the >> .authinfo file? >> >> 3. Is there a command to insert the X-Message-SMTP-Method header? >> >> 4. When entering the value for the X-Message-SMTP-Method header, is >> there a way to use completion to select from available smtp servers, or >> from the entries in .authinfo? >> >> It would seem like an excessive amount of work, and error prone, to type >> in something like >> >> X-Message-SMTP-Method: smtp smtp.fsf.org 587 other-user >> >> every time I want to send an email. > > I think the idea is to use posting styles to tell gnus to set up the > appropriate STMP method header, depending on your From address. As far > as I know, however, that means you can't cycle the From address in the > message-mode buffer and have it do the right thing. You'd have specify > the From address before the message buffer is set up. I'm looking at > this now, and I'll probably set up a wrapper around compose-mail. Here's a simplified version of the ugly hack I use to do this. (defun rasmus/compose-mail (&optional arg) "Compose a mail with the possibility to choose a style if ARG is non-nil" (interactive "P") (require 'gnus-util) (unless (gnus-alive-p) (gnus) (bury-buffer)) (if (not arg) (compose-mail) (let* ((accounts (mapcar (lambda (x) (let ((adr (cadr (assoc 'GCC x))));; TODO: fragile (cons (replace-regexp-in-string ".*:\\([[:ascii:]]+\\)/.*" "\\1" adr) adr))) gnus-posting-styles)) (choice (ido-completing-read "Choose account" (mapcar 'car accounts))) (gnus-newsgroup-name (cdr-safe (assoc choice accounts)))) (gnus-summary-mail-other-window)))) nljlistbox2@gmail.com (N. Jackson) writes: > And what about the settings of variables like smtpmail-smtp-service, > smtpmail-starttls-credentials, smtpmail-auth-credentials etc.? Do they > get factored in to the mix, or are they ignored when the > "X-Message-SMTP-Method" header is used? You set that in your posting style as well. Here's an example (the eval line in the end). (setq gnus-posting-styles '(((lambda () (rasmus/gnus-posting-style-identify "school" '("To" . "rasmus@school\\.edu") (lambda () (pank/message-mailto-test "school\\.edu")))) (address "rasmus@school.eu") ;; (Face (gnus-convert-png-to-face (expand-file-name "school.png" gnus-face-direcotry))) (Organization "School") (GCC "nnimap+mail:school/sent") (X-Message-SMTP-Method "smtp server.com 587 rasmus@school.edu") (signature "My sig") (eval (setq smtpmail-stream-type nil))))) Also, the X-message-SMTP-Method seems to be stripped from a quick test (examining a raw message send to myself). Hope it helps, Rasmus -- Enough with the bla bla!