unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Simon Campese <notmuchmail_org@campese.de>
To: Jameson Graef Rollins <jrollins@finestructure.net>
Cc: notmuch@notmuchmail.org
Subject: Re: Set "From" based on "To" when replying
Date: Sat, 11 Feb 2012 00:51:00 +0100	[thread overview]
Message-ID: <877gzujli3.fsf@tu-dortmund.de> (raw)
In-Reply-To: <8739atqfun.fsf@servo.finestructure.net>

> 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

  reply	other threads:[~2012-02-10 23:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2012-02-03 11:54 ` Tomi Ollila
2012-02-10 20:04   ` Simon Campese
2012-02-10 23:34 ` Istvan Marko

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

  List information: https://notmuchmail.org/

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

  git send-email \
    --in-reply-to=877gzujli3.fsf@tu-dortmund.de \
    --to=notmuchmail_org@campese.de \
    --cc=jrollins@finestructure.net \
    --cc=notmuch@notmuchmail.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.
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).