feature request: regular expressions inside "other_email"-field

Subject:feature request: regular expressions inside "other_email"-field

Date:Sat, 09 Jan 2016 15:36:10 +0000



From:Simon Campese


background story (you can skip to the next paragraph for the actual
feature request):
I have a special "spam domain" with a catchall-email (all mails sent to
my domain are forwarded to this email, unless there exists an actual
account), so that I can give out customized email-adresses on the fly
("company_a@mydomain.org' to company A, "website_org@mydomain.org" when
registering on website.org etc.) when I need to fill in an email address
somewhere. This way, I can not only  easily filter all unimportant mail
to a secondary mailbox, but also see exactly where spammers got my email
from. The problem now comes when I need to reply to such an email:
As I of course don't edit my notmuch-config to adjust the other_email
field everytime I invent such an email-address, notmuch doesn't know
that the mail was written to me and thus puts in my standard email
inside the from-header. I thus have to remember to manually change the
from-header and put in the customized email. It would be much more
convenient if I could teach notmuch that all adresses of some special
form (for example written to some domain) are all mine and thus should be
copied from the to-header to the from-header when replying.

As far as I can see, there are at least two possible solutions:

1. (quick and dirty):
Write a function which copies the to-header to the from-header if it
matches some regular expression and call it from message-setup-hook.

2. (more general):
Make the other_email field inside notmuch-config regular-expression
aware (or maybe just support to indicate domain parts). This way, one could write
something like


and notmuch would always copy the to-header to the from-header when
replying to mails sent to something@mydomain.org

I would be very thankful for any solution to this problem as it would save
me a LOT of time every day. I tried to write a function for the
message-setup-hook but due to my very limited knowledge of elisp and
notmuch I didn't get it to work properly.