--- /dev/null
+Return-Path:\r
+ <return-dqk5s59tpxtrvs7yjhukdm9c56@temporary-address.scs.stanford.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id C711C6DE0B27\r
+ for <notmuch@notmuchmail.org>; Tue, 21 Jul 2015 17:41:45 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.055\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.055 tagged_above=-999 required=5 tests=[AWL=0.796,\r
+ RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-0.55, SPF_PASS=-0.001]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id daGRXxEK5NSx for <notmuch@notmuchmail.org>;\r
+ Tue, 21 Jul 2015 17:41:43 -0700 (PDT)\r
+X-Greylist: delayed 1203 seconds by postgrey-1.35 at arlo;\r
+ Tue, 21 Jul 2015 17:41:43 PDT\r
+Received: from market.scs.stanford.edu (market.scs.stanford.edu [171.66.3.10])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id B32AC6DE0AD1\r
+ for <notmuch@notmuchmail.org>; Tue, 21 Jul 2015 17:41:43 -0700 (PDT)\r
+Received: from market.scs.stanford.edu (localhost.scs.stanford.edu\r
+ [127.0.0.1]) by market.scs.stanford.edu (8.14.7/8.14.7) with ESMTP id\r
+ t6M0LbSw027122; Tue, 21 Jul 2015 17:21:37 -0700 (PDT)\r
+Received: (from dm@localhost)\r
+ by market.scs.stanford.edu (8.14.7/8.14.7/Submit) id t6M0LbPk016153;\r
+ Tue, 21 Jul 2015 17:21:37 -0700 (PDT)\r
+X-Authentication-Warning: market.scs.stanford.edu: dm set sender to\r
+ return-dqk5s59tpxtrvs7yjhukdm9c56@ta.scs.stanford.edu using -f\r
+From: David Mazieres <dm-list-email-notmuch@scs.stanford.edu>\r
+To: mailinglists@nawaz.org, notmuch@notmuchmail.org\r
+Subject: Re: Modify message after send...?\r
+In-Reply-To: <878uacpwse.fsf@fester.com>\r
+References: <878uacpwse.fsf@fester.com>\r
+Reply-To: David Mazieres expires 2015-10-19 PDT\r
+ <mazieres-ikhhtkgnuesn6x67wa9p6axshs@temporary-address.scs.stanford.edu>\r
+Date: Tue, 21 Jul 2015 17:21:36 -0700\r
+Message-ID: <87y4i9xcrz.fsf@ta.scs.stanford.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\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: Wed, 22 Jul 2015 00:41:45 -0000\r
+\r
+mailinglists@nawaz.org writes:\r
+\r
+> Hi,\r
+>\r
+> I use notmuch via Emacs.\r
+>\r
+> Here's what I want:\r
+>\r
+> When I hit C-c C-c to send a message, I'd like it to be passed to a\r
+> script (likely a Python one, although I may consider an Elisp function\r
+> if an external script is not possible) for modification of headers,\r
+> before it is sent to the MTA (Postfix in my case). A bonus would be to\r
+> have the modified message stored in the FCC location, instead of the\r
+> original one.\r
+>\r
+> Is this possible? An alternative may be to modify the message /before/\r
+> it goes to message-send-and-exit. I'm inexperienced in Elisp - would\r
+> this be via what's called "advising"?\r
+>\r
+> BTW, all I really want to do is modify the From: field based on the\r
+> recipients (for every email, with no default From). I'll welcome\r
+> suggestions for existing ways to do that. I Googled a little, but didn't\r
+> find a clear good solution. Furthermore, I expect over time the rules by\r
+> which I pick the From: field will get more complex than my knowledge of\r
+> Elisp.\r
+\r
+For modifying the From field, I recommend doing it before you send the\r
+message, as this gives you an opportunity to see what you are about to\r
+send and possibly edit it by hand.\r
+\r
+I do something like this using defadvice around notmuch-mua-mail, do\r
+adjust things about my messages. I also put a defadvice around\r
+notmuch-call-notmuch-sexp to filter the To and Cc headers I get from\r
+"notmuch reply" (because notmuch won't let me put wildcards in my\r
+.notmuch-config file).\r
+\r
+Finally, and possibly most relevant to you, I use a message-send-hook to\r
+insert the Return-Path address and make a few more modifications before\r
+sending a message. Note that I only do this if there isn't already a\r
+Return-Path header. That way, if I type C-c C-c and don't like what I\r
+see, I edit the result and send again, leaving the generated Return-Path\r
+header, and this time it goes through unmodified.\r
+\r
+David\r