Gnus development mailing list
 help / color / mirror / Atom feed
From: jorge.alfaro-murillo@yale.edu (Jorge A. Alfaro-Murillo)
To: ding@gnus.org
Subject: Re: separate smtps for my accounts
Date: Fri, 12 Sep 2014 11:05:56 -0400	[thread overview]
Message-ID: <871trgop4b.fsf@yale.edu> (raw)
In-Reply-To: <87egvhsi8y.fsf@ericabrahamsen.net>

Eric Abrahamsen writes: 

> Sharon Kimble <boudiccas@skimble.plus.com> 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.




  reply	other threads:[~2014-09-12 15:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-12  0:58 Sharon Kimble
2014-09-12  2:08 ` Eric Abrahamsen
2014-09-12 15:05   ` Jorge A. Alfaro-Murillo [this message]
2014-09-13 22:03   ` Sharon Kimble
2014-09-14  2:01     ` Eric Abrahamsen
2014-09-16 18:57       ` Sharon Kimble
2014-09-17  2:17         ` Eric Abrahamsen
2014-09-24 15:24           ` Ted Zlatanov
2014-09-17 12:32         ` Rasmus
2014-09-17  8:37     ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871trgop4b.fsf@yale.edu \
    --to=jorge.alfaro-murillo@yale.edu \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).