From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/84919 Path: news.gmane.org!not-for-mail From: jorge.alfaro-murillo@yale.edu (Jorge A. Alfaro-Murillo) Newsgroups: gmane.emacs.gnus.general Subject: Re: separate smtps for my accounts Date: Fri, 12 Sep 2014 11:05:56 -0400 Message-ID: <871trgop4b.fsf@yale.edu> References: <87tx4dodsj.fsf@skimble.plus.com> <87egvhsi8y.fsf@ericabrahamsen.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: ger.gmane.org 1410534516 21554 80.91.229.3 (12 Sep 2014 15:08:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Sep 2014 15:08:36 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M33163@lists.math.uh.edu Fri Sep 12 17:08:29 2014 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XSSSV-0003Fu-QQ for ding-account@gmane.org; Fri, 12 Sep 2014 17:08:24 +0200 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 1XSSQz-00018x-Hw; Fri, 12 Sep 2014 10:06:49 -0500 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 1XSSQx-00018k-P1 for ding@lists.math.uh.edu; Fri, 12 Sep 2014 10:06:47 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1XSSQv-0001oQ-6H for ding@lists.math.uh.edu; Fri, 12 Sep 2014 10:06:47 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1XSSQt-0000x4-9e for ding@gnus.org; Fri, 12 Sep 2014 17:06:43 +0200 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XSSQr-0002KC-IK for ding@gnus.org; Fri, 12 Sep 2014 17:06:41 +0200 Original-Received: from nat-130-132-173-153.central.yale.edu ([130.132.173.153]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Sep 2014 17:06:41 +0200 Original-Received: from jorge.alfaro-murillo by nat-130-132-173-153.central.yale.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Sep 2014 17:06:41 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 66 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nat-130-132-173-153.central.yale.edu User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) Cancel-Lock: sha1:zlGlyzWfXD7sA2CKMZy2weBMg2s= X-Spam-Score: -5.1 (-----) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:84919 Archived-At: Eric Abrahamsen writes: > Sharon Kimble writes: > >> In my gnus setup I have 1 pop3 account, and 3 imap accounts, >> but only one smtp address. How can I have a separate smtp >> settings so that I am able to reply via the address of the >> email that I've just received? >> >> Thanks Sharon. > > The details depend a little bit on the exact program you're > using for sending mail, but generally the rigmarole looks like > this (I use msmtp): > > (defun cg-feed-msmtp () > (if (message-mail-p) > (save-excursion > (let* ((from (save-restriction (message-narrow-to-headers) > (message-fetch-field "from"))) (account (cond ;; I use email > address as account label in ~/.msmtprc ((string-match > "eric@ericabrahamsen.net" from) "ea") ((string-match > "account_two@gmail.com" from) "acc2") ((string-match > "more_accounts@domain.org" from) "more")))) (setq > message-sendmail-extra-arguments (list '"-a" account)))))) > > (setq message-sendmail-envelope-from 'header) (add-hook > 'message-send-mail-hook 'cg-feed-msmtp) > I have two smtp addresses, one for work and a personal one at Gmail, and I used to have a similar setup. But I discovered recently that you can configure Gmail to send mail from another address (In Gmail: Settings, Accounts and Import, Send mail as), so I just left my smtpmail with gmail, and now Gmail decides from where to send the email according to the "From" field in the message. I set up my user-mail-address as my work email, since that is the one I generally use, and then use gnus-posting-styles, so that if someone sends me a personal email, I reply using the personal email: #+BEGIN_SRC emacs-lisp (setq gnus-posting-styles `( ... ((header "To" ,(regexp-quote "username@gmail.com")) (address "username@gmail.com")) ((header "CC" ,(regexp-quote "username@gmail.com")) (address "username@gmail.com")) ((header "BCC" ,(regexp-quote "username@gmail.com")) (address "username@gmail.com")) ... #+END_SRC This method has the advantage of keeping a copy of the sent mail from the work address in the Sent Mail folder of Gmail, so all sent mail is in one place. Best, -- Jorge.