unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Set "From" based on "To" when replying
@ 2012-01-21 15:35 Simon Campese
  2012-02-02 17:26 ` Jani Nikula
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Simon Campese @ 2012-01-21 15:35 UTC (permalink / raw)
  To: notmuch

Dear Community,

I've got my own domain and when registering or shopping at some website,
I always use email addresses of the form "websitename@mydomain.org", so
for example I use "amazon@mydomain.org" when shopping at amazon. The
reason for this is categorizing incoming mail on the one hand, and
immediately being able to spot the source of spam on the other hand. 

I would like to implement the following behaviour: When replying to a
mail that has "something@mydomain.org" in the "To"-header, I would like
to have the "From"-header of the reply to be automatically set to this
address. 

Is there some kind of reply-hook in notmuch where one could put an
appropriate function? 


Thank you very much for your help,

Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Set "From" based on "To" when replying
  2012-01-21 15:35 Set "From" based on "To" when replying Simon Campese
@ 2012-02-02 17:26 ` Jani Nikula
  2012-02-02 17:56   ` Jameson Graef Rollins
  2012-02-03 11:54 ` Tomi Ollila
  2012-02-10 23:34 ` Istvan Marko
  2 siblings, 1 reply; 7+ messages in thread
From: Jani Nikula @ 2012-02-02 17:26 UTC (permalink / raw)
  To: Simon Campese, notmuch

On Sat, 21 Jan 2012 16:35:10 +0100, Simon Campese <notmuchmail_org@campese.de> wrote:
> Dear Community,
> 
> I've got my own domain and when registering or shopping at some website,
> I always use email addresses of the form "websitename@mydomain.org", so
> for example I use "amazon@mydomain.org" when shopping at amazon. The
> reason for this is categorizing incoming mail on the one hand, and
> immediately being able to spot the source of spam on the other hand. 
> 
> I would like to implement the following behaviour: When replying to a
> mail that has "something@mydomain.org" in the "To"-header, I would like
> to have the "From"-header of the reply to be automatically set to this
> address. 
> 
> Is there some kind of reply-hook in notmuch where one could put an
> appropriate function? 

Do you have all those email addresses in the user.other_email
configuration option in your ~/.notmuch-config? It should do the trick,
though I can see that it might get a bit tedious if you use plenty of
email addresses like above.

BR,
Jani.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Set "From" based on "To" when replying
  2012-02-02 17:26 ` Jani Nikula
@ 2012-02-02 17:56   ` Jameson Graef Rollins
  2012-02-10 23:51     ` Simon Campese
  0 siblings, 1 reply; 7+ messages in thread
From: Jameson Graef Rollins @ 2012-02-02 17:56 UTC (permalink / raw)
  To: Jani Nikula, Simon Campese, notmuch

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

On Thu, 02 Feb 2012 19:26:53 +0200, Jani Nikula <jani@nikula.org> wrote:
> Do you have all those email addresses in the user.other_email
> configuration option in your ~/.notmuch-config? It should do the trick,
> though I can see that it might get a bit tedious if you use plenty of
> email addresses like above.

Yeah, I think this is the point: you want "*@mydomain.org" to be one of
the user.other_email.  I don't see why that couldn't be done with a
little work in notmuch-reply.c.  I wouldn't mind seeing this
functionality as well, actually.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Set "From" based on "To" when replying
  2012-01-21 15:35 Set "From" based on "To" when replying Simon Campese
  2012-02-02 17:26 ` Jani Nikula
@ 2012-02-03 11:54 ` Tomi Ollila
  2012-02-10 20:04   ` Simon Campese
  2012-02-10 23:34 ` Istvan Marko
  2 siblings, 1 reply; 7+ messages in thread
From: Tomi Ollila @ 2012-02-03 11:54 UTC (permalink / raw)
  To: Simon Campese, notmuch

On Sat, 21 Jan 2012 16:35:10 +0100, Simon Campese <notmuchmail_org@campese.de> wrote:
> Dear Community,
> 
> I've got my own domain and when registering or shopping at some website,
> I always use email addresses of the form "websitename@mydomain.org", so
> for example I use "amazon@mydomain.org" when shopping at amazon. The
> reason for this is categorizing incoming mail on the one hand, and
> immediately being able to spot the source of spam on the other hand. 
> 
> I would like to implement the following behaviour: When replying to a
> mail that has "something@mydomain.org" in the "To"-header, I would like
> to have the "From"-header of the reply to be automatically set to this
> address. 
> 
> Is there some kind of reply-hook in notmuch where one could put an
> appropriate function? 

You could (also) check this (or some other with same name)

https://github.com/altruizine/gnus-alias/blob/master/gnus-alias.el

( should not be gnus-spesific )

I've planned to take a look and write a wiki page but I don't
promise doing any of that soon...

> Thank you very much for your help,
> 
> Simon

Tomi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Set "From" based on "To" when replying
  2012-02-03 11:54 ` Tomi Ollila
@ 2012-02-10 20:04   ` Simon Campese
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Campese @ 2012-02-10 20:04 UTC (permalink / raw)
  To: Tomi Ollila; +Cc: notmuch

On Fri, 03 Feb 2012 13:54:07 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> You could (also) check this (or some other with same name)
> 
> https://github.com/altruizine/gnus-alias/blob/master/gnus-alias.el


Thanks for the link, but this method is interactive. I want something
automatic. Nevertheless a nice thing to have when composing emails.


Best,

Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Set "From" based on "To" when replying
  2012-01-21 15:35 Set "From" based on "To" when replying Simon Campese
  2012-02-02 17:26 ` Jani Nikula
  2012-02-03 11:54 ` Tomi Ollila
@ 2012-02-10 23:34 ` Istvan Marko
  2 siblings, 0 replies; 7+ messages in thread
From: Istvan Marko @ 2012-02-10 23:34 UTC (permalink / raw)
  To: Notmuch Mail

Simon Campese <notmuchmail_org-W/QFD0wfgqiELgA04lAiVw@public.gmane.org>
writes:

> I would like to implement the following behaviour: When replying to a
> mail that has "something-3Q2Tfjf0mexg9hUCZPvPmw@public.gmane.org" in the "To"-header, I would like
> to have the "From"-header of the reply to be automatically set to this
> address. 

message-alternative-emails and message-dont-reply-to-names might help to
handle this.

-- 
	Istvan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Set "From" based on "To" when replying
  2012-02-02 17:56   ` Jameson Graef Rollins
@ 2012-02-10 23:51     ` Simon Campese
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Campese @ 2012-02-10 23:51 UTC (permalink / raw)
  To: Jameson Graef Rollins; +Cc: notmuch

> Yeah, I think this is the point: you want "*@mydomain.org" to be one of
> the user.other_email.  I don't see why that couldn't be done with a
> little work in notmuch-reply.c.  I wouldn't mind seeing this
> functionality as well, actually.

So here's my shabby solution (pasted from my .emacs):

;;automatically take From: from To: if mail was sent to .*@mydomain.org

(defun notmuch-show-reply-sender-mod ()
  (interactive)
(if (string-match ".*@campese.de" (notmuch-show-get-header :To))
(notmuch-mua-reply (notmuch-show-get-message-id) (notmuch-show-get-header :To)
nil) (notmuch-show-reply-sender)))

(defun notmuch-show-reply-mod ()
  (interactive)
(if (string-match ".*@campese.de" (notmuch-show-get-header :To))
(notmuch-mua-reply (notmuch-show-get-message-id) (notmuch-show-get-header :To) t)
(notmuch-show-reply)))

(define-key notmuch-show-mode-map "r" 'notmuch-show-reply-sender-mod)
(define-key notmuch-show-mode-map "R" 'notmuch-show-reply-mod)

If it sees "@mydomain.org" in the 'To'-header, it copies the whole
"To:"-header to the "From:" header when replying. This works as long as
I'm the only one in the "To:"-header, which usually is the case (I only
use this "special" email addreses when registering at online-shops,
forums, etc. to be able to easily track where spammers got my email
from.

I totally agree that a clean solution would be regular expressions in
the primary_email and other_email fields in notmuch-config.

Anyone up for implementing this? :-)

Best,

Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-02-10 23:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-21 15:35 Set "From" based on "To" when replying Simon Campese
2012-02-02 17:26 ` Jani Nikula
2012-02-02 17:56   ` Jameson Graef Rollins
2012-02-10 23:51     ` Simon Campese
2012-02-03 11:54 ` Tomi Ollila
2012-02-10 20:04   ` Simon Campese
2012-02-10 23:34 ` Istvan Marko

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).