[Techtalk] mutt hooks (was PGP signing mail)

Akkana Peck akkana at shallowsky.com
Mon Jun 7 14:46:32 EST 2004


Telsa Gwynne writes:
>   Usage: send-hook [!]pattern command
>  
>   This command can be used to execute arbitrary configuration commands
>   based upon recipients of the message.  pattern is a regular expression
>   matching the desired address.  command is executed when regexp matches
>   recipients of the message. [...]
> 
>   Example: send-hook mutt "set mime_forward signature=''"

One thing to be aware of, though, when using mutt's send-hooks or
folder-hooks, is that if you set a variable, that variable
stays set for the rest of the session, unless you have another
hook unset it.  So if you have one hook that sets a PGP variable
for one list, and another hook that sets a special signature for
another list, and another hook that sets your From header to
something special ... then you'd better make sure that every
message you send somehow passes through a hook that resets all
the variables except the ones you want for that message.
Otherwise you'll end up sending mail differently depending on
what you read and sent prior to sending the current message.

Is there a better way of handling this?  Or, better yet, a way to say
"As a send-hook for this list, set this variable, then unset it
again after the message is sent"?  I suppose you could put all the
variables to be cleared into a ~/.mutt_defaults script, and source
that as the first operation in any hook.

	...Akkana


More information about the Techtalk mailing list