Re: Set "From" based on "To" when replying
authorSimon Campese <notmuchmail_org@campese.de>
Fri, 10 Feb 2012 23:51:00 +0000 (00:51 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:21 +0000 (09:44 -0800)
e8/f34052aaf2bbc939620f23393af94a2c667b0c [new file with mode: 0644]

diff --git a/e8/f34052aaf2bbc939620f23393af94a2c667b0c b/e8/f34052aaf2bbc939620f23393af94a2c667b0c
new file mode 100644 (file)
index 0000000..7154e0e
--- /dev/null
@@ -0,0 +1,89 @@
+Return-Path: <notmuchmail_org@campese.de>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 30C28431FAE\r
+       for <notmuch@notmuchmail.org>; Fri, 10 Feb 2012 15:51:04 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id raRghUsTA+sH for <notmuch@notmuchmail.org>;\r
+       Fri, 10 Feb 2012 15:51:03 -0800 (PST)\r
+Received: from mail01.worldserver.net (mail01.worldserver.net [217.13.200.41])\r
+       by olra.theworths.org (Postfix) with ESMTP id 26FAF431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 10 Feb 2012 15:51:03 -0800 (PST)\r
+Received: from localhost (cable-83.217.143.231.coditel.net [83.217.143.231])\r
+       (Authenticated sender: mailer@campese.de)\r
+       by mail01.worldserver.net (Postfix) with ESMTPSA id 205263000D6;\r
+       Sat, 11 Feb 2012 00:52:14 +0100 (CET)\r
+From: Simon Campese <notmuchmail_org@campese.de>\r
+To: Jameson Graef Rollins <jrollins@finestructure.net>\r
+Subject: Re: Set "From" based on "To" when replying\r
+In-Reply-To: <8739atqfun.fsf@servo.finestructure.net>\r
+References: <87obtx5as1.fsf@tu-dortmund.de> <87obthxi1u.fsf@nikula.org>\r
+       <8739atqfun.fsf@servo.finestructure.net>\r
+User-Agent: Notmuch/0.11+128~g6f388fa (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-unknown-linux-gnu)\r
+Date: Sat, 11 Feb 2012 00:51:00 +0100\r
+Message-ID: <877gzujli3.fsf@tu-dortmund.de>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 10 Feb 2012 23:51:04 -0000\r
+\r
+> Yeah, I think this is the point: you want "*@mydomain.org" to be one of\r
+> the user.other_email.  I don't see why that couldn't be done with a\r
+> little work in notmuch-reply.c.  I wouldn't mind seeing this\r
+> functionality as well, actually.\r
+\r
+So here's my shabby solution (pasted from my .emacs):\r
+\r
+;;automatically take From: from To: if mail was sent to .*@mydomain.org\r
+\r
+(defun notmuch-show-reply-sender-mod ()\r
+  (interactive)\r
+(if (string-match ".*@campese.de" (notmuch-show-get-header :To))\r
+(notmuch-mua-reply (notmuch-show-get-message-id) (notmuch-show-get-header :To)\r
+nil) (notmuch-show-reply-sender)))\r
+\r
+(defun notmuch-show-reply-mod ()\r
+  (interactive)\r
+(if (string-match ".*@campese.de" (notmuch-show-get-header :To))\r
+(notmuch-mua-reply (notmuch-show-get-message-id) (notmuch-show-get-header :To) t)\r
+(notmuch-show-reply)))\r
+\r
+(define-key notmuch-show-mode-map "r" 'notmuch-show-reply-sender-mod)\r
+(define-key notmuch-show-mode-map "R" 'notmuch-show-reply-mod)\r
+\r
+If it sees "@mydomain.org" in the 'To'-header, it copies the whole\r
+"To:"-header to the "From:" header when replying. This works as long as\r
+I'm the only one in the "To:"-header, which usually is the case (I only\r
+use this "special" email addreses when registering at online-shops,\r
+forums, etc. to be able to easily track where spammers got my email\r
+from.\r
+\r
+I totally agree that a clean solution would be regular expressions in\r
+the primary_email and other_email fields in notmuch-config.\r
+\r
+Anyone up for implementing this? :-)\r
+\r
+Best,\r
+\r
+Simon\r