Re: Order of send-hook and folder-hook options.
- To: mutt-users@xxxxxxxx
- Subject: Re: Order of send-hook and folder-hook options.
- From: Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx>
- Date: Wed, 10 Oct 2007 17:43:44 -0500
- Comment: DomainKeys? See http://domainkeys.sourceforge.net/
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=memoryhole.net; h=date:from:to:subject:message-id:references:mime-version:content-type:content-transfer-encoding:in-reply-to; q=dns/txt; s=default; bh=aSSW4I9o5k6XuABf5ke0on5DMb8=; b=LBsQ3aAFbYLz/YHOPlcaY8ePs+l4sr5jsdoYmymvZUbS/KumcXhKUsRugPtW4d8pTn3OjIJs1+tuxW2TYJU+HP2A+xuY7L8GCj9QdMLdkt9m5lgvD06NjQjLoOc9eiuynEb4mRss3uVUD6WteY4Qf3q5yy3r1oyJ6zYabUTQhEo=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=memoryhole.net; b=Yd6HF19gG0Aj5fgMvYpziYaQUvyEIeKRxCpEZpgIp8A4cz+63MzdAHeSneNzYCQBHtvpHrATh6MUepV+8icAGwdcHbkOXmxUnz8OBNUeFN3OU+Ngnwkqv8XqLrB24L3DCQo3ypKmenBfgRj+8MyBseGslsM1VsfQ5m0V0IiQtwQ=; h=Received:Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:Content-Transfer-Encoding:In-Reply-To:User-Agent;
- In-reply-to: <20071010220021.GC62343@xxxxxxxxxxxx>
- List-post: <mailto:mutt-users@mutt.org>
- List-unsubscribe: send mail to majordomo@mutt.org, body only "unsubscribe mutt-users"
- Mail-followup-to: mutt-users@xxxxxxxx
- References: <20071010220021.GC62343@xxxxxxxxxxxx>
- Sender: owner-mutt-users@xxxxxxxx
- User-agent: Mutt/1.5.16 (2007-09-19)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday, October 10 at 11:00 PM, quoth Benjamin A'Lee:
>I can do a):
>
> folder-hook . my_hdr From: address_a
> folder-hook =lists my_hdr From: address_b
>
>Or, I can do b):
>
> send-hook . my_hdr From: address_a
> send-hook @example.com my_hdr From: address_c
>
>What I can't do is have both. The send-hook runs on every message, so
>overrides the configured address for the folder.
What about something like this:
folder-hook . my_hdr From: address_a
folder-hook =lists my_hdr From: address_b
send-hook '!~f address_b' 'my_hdr From: address_a'
send-hook '~C @example.com' 'my_hdr From: address_c'
Thus, the first send-hook will only trigger if the second folder-hook
didn't trigger (i.e. it shouldn't override your folder-hook), and the
second send-hook will override things if your recipient is
@example.com. You could make the second send-hook subservient to the
folder hooks by simply adding another condition, e.g.:
send-hook '~C @example.com !~f address_b' 'my_hdr From: address_c'
But, if send-hooks don't want to match on your currently-configured
from address (and I see no reason why they'd be so persnickety), you
could use a variable to gate them, like this (again, I haven't tested
this):
folder-hook . 'set my_stophook=no; my_hdr From: address_a'
folder-hook =lists 'set my_stophook=yes; my_hdr From: address_b'
send-hook . \
'`[ $my_stophook == yes ] && echo set my_stophook || echo my_hdr From:
address_a`'
send-hook '~C @example.com' 'my_hdr From: address_c'
Of course, you may want to do something a little simpler, and a little
more effective than using a folder-hook to set your return address.
Personally, I'd do something like this:
send-hook . my_hdr From: address_a
send-hook ~l my_hdr From: address_b
send-hook @example.com my_hdr From: address_c
~Kyle
- --
Look, I can surely say by now that I've got the antibodies to
communism inside me. But when I think of consumer society, with all
its tragedies, I wonder which of the two systems is better.
-- Pope John Paul II, 1979
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!
iD8DBQFHDVWgBkIOoMqOI14RArJsAJ955XQ4lWyBM9UtBlUzTXc9S2EwHACguuN9
yJ9hH4FhTAW3j5oPiccMGpI=
=kVni
-----END PGP SIGNATURE-----