Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 9CCA06DE021D for ; Sun, 19 Jul 2015 10:05:21 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.12 X-Spam-Level: X-Spam-Status: No, score=-0.12 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eaUWNRxl6R7D for ; Sun, 19 Jul 2015 10:05:19 -0700 (PDT) X-Greylist: delayed 448 seconds by postgrey-1.35 at arlo; Sun, 19 Jul 2015 10:05:19 PDT Received: from hapkido.dreamhost.com (hapkido.dreamhost.com [66.33.216.122]) by arlo.cworth.org (Postfix) with ESMTP id 01FB66DE014A for ; Sun, 19 Jul 2015 10:05:18 -0700 (PDT) Received: from homiemail-a32.g.dreamhost.com (sub4.mail.dreamhost.com [69.163.253.135]) by hapkido.dreamhost.com (Postfix) with ESMTP id 302158F465 for ; Sun, 19 Jul 2015 09:57:50 -0700 (PDT) Received: from homiemail-a32.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a32.g.dreamhost.com (Postfix) with ESMTP id 8D379584076; Sun, 19 Jul 2015 09:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=nawaz.org; h=mime-version :content-type:content-transfer-encoding:date:from:to:cc:subject :in-reply-to:references:message-id; s=nawaz.org; bh=fe4Y7s/EeU2g OZhqp6xSMhRWj4U=; b=G1OH1+9BTprgcxAi+lW9InicQDSomydTDC9o7WB6lnZL McgXmypooGM/p6oXhnYOK9g8VlW5+rk3/bbubudBcDNLUZx3U2OyQ9Yuq4pc2aTN bVnybWFLhqCqVV4PPkbnaZEy7BiDMFCGbDCcSBq6F/byEo4E/beDZr4OM2ORdMA= Received: from roundcube.dreamhost.com (caiajhbihbdd.dreamhost.com [208.97.187.133]) (Authenticated sender: mueen@nawaz.org) by homiemail-a32.g.dreamhost.com (Postfix) with ESMTPA id 88D8F584074; Sun, 19 Jul 2015 09:57:46 -0700 (PDT) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 19 Jul 2015 09:57:46 -0700 From: MN To: David Bremner Subject: Re: Modify message after =?UTF-8?Q?send=2E=2E=2E=3F?= In-Reply-To: <87a8uswpan.fsf@maritornes.cs.unb.ca> References: <878uacpwse.fsf@fester.com> <87a8uswpan.fsf@maritornes.cs.unb.ca> Message-ID: <7d2fea075322f8a87ddfc3082eb4964d@nawaz.org> X-Sender: mailinglists@nawaz.org User-Agent: Roundcube Webmail/0.8.2 Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jul 2015 17:05:21 -0000 On 2015-07-19 00:59, David Bremner wrote: > mailinglists@nawaz.org writes: > >> BTW, all I really want to do is modify the From: field based on the >> recipients (for every email, with no default From). I'll welcome >> suggestions for existing ways to do that. I Googled a little, but >> didn't >> find a clear good solution. Furthermore, I expect over time the >> rules by >> which I pick the From: field will get more complex than my knowledge >> of >> Elisp. > > I'm afraid it's a bit "some-assembly-required", but let me mention > one > possible solution. > > At least if you just want to have a regular expression match on the > recipient, then the example configuration in message-templ [1] may be > enough to get you started. You'd have to either call > message-templ-config-exec in a hook, or bind it to a key and call it > manually to set up the headers before sending. > > [1]: http://pivot.cs.unb.ca/git?p=message-templ.git;a=tree Thanks for this. I'll see if I can follow the Elisp code. After sending my email, it occurred to me that message handling is not notmuch's job - that's passed on to message-mode. I figured message-mode must have some kind of hook before sending the email, and sure enough, it does have message-send-hook. The example at www.gnu.org/software/emacs/manual/html_mono/message.html shows how one can add headers before sending. There's also message-alternative-emails, although that likely works only if you're replying to an email. A little frustrating: They have a number of functions to modify/read fields like Subject, or To - but none for From! So I'll still have to do some surgery. I'll likely use the send-message-hook to: 1. Read the "To" & "cc" values. 2. Pass them to an external Python script. 3. Get the appropriate "From" field from the Python script. 4. Insert it into the From: field. How does one do steps 2 & 3 in Elisp? I just need a pointer. (Just Googled and saw this: http://stackoverflow.com/questions/5014246/how-to-capture-standard-output-of-a-shell-command-in-elisp) Thanks,