From: Simon Campese Date: Fri, 10 Feb 2012 23:51:00 +0000 (+0100) Subject: Re: Set "From" based on "To" when replying X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=e26e8518b7599fc676e4f5e27b17afa6a5f5fc5c;p=notmuch-archives.git Re: Set "From" based on "To" when replying --- diff --git a/e8/f34052aaf2bbc939620f23393af94a2c667b0c b/e8/f34052aaf2bbc939620f23393af94a2c667b0c new file mode 100644 index 000000000..7154e0e68 --- /dev/null +++ b/e8/f34052aaf2bbc939620f23393af94a2c667b0c @@ -0,0 +1,89 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 30C28431FAE + for ; Fri, 10 Feb 2012 15:51:04 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id raRghUsTA+sH for ; + Fri, 10 Feb 2012 15:51:03 -0800 (PST) +Received: from mail01.worldserver.net (mail01.worldserver.net [217.13.200.41]) + by olra.theworths.org (Postfix) with ESMTP id 26FAF431FB6 + for ; Fri, 10 Feb 2012 15:51:03 -0800 (PST) +Received: from localhost (cable-83.217.143.231.coditel.net [83.217.143.231]) + (Authenticated sender: mailer@campese.de) + by mail01.worldserver.net (Postfix) with ESMTPSA id 205263000D6; + Sat, 11 Feb 2012 00:52:14 +0100 (CET) +From: Simon Campese +To: Jameson Graef Rollins +Subject: Re: Set "From" based on "To" when replying +In-Reply-To: <8739atqfun.fsf@servo.finestructure.net> +References: <87obtx5as1.fsf@tu-dortmund.de> <87obthxi1u.fsf@nikula.org> + <8739atqfun.fsf@servo.finestructure.net> +User-Agent: Notmuch/0.11+128~g6f388fa (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-unknown-linux-gnu) +Date: Sat, 11 Feb 2012 00:51:00 +0100 +Message-ID: <877gzujli3.fsf@tu-dortmund.de> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Fri, 10 Feb 2012 23:51:04 -0000 + +> 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