<<< Date Index >>>     <<< Thread Index >>>

Re: send-hook and my_hdr oddities



* Aron Griffis <agriffis@xxxxxxxxxx> [2004-02-25 16:08 -0500]:
> I have the following in my .muttrc (among other things, of course):
> 
>   send-hook .            unmy_hdr Bcc
>   send-hook "~C hp.com"  my_hdr Bcc: Aron Griffis <my_hp_address>
> 
> I see the strangest behavior...
> 
>   1. Hit m to write a new message to somebody@xxxxxxx
>      However the Bcc isn't set!
> 
>   2. Repeat #1, this time the Bcc is set to Aron Griffis <my_hp_address>
> 
>   3. Write a message elsewhere (non-hp), Bcc remains set to 
>      Aron Griffis <my_hp_address>
> 
>   4. Repeat #3, this time the Bcc is unset.
> 
> It seems that the send-hook is somehow trailing the message creation and
> applying to the next message instead of the current one.  Ideas?  I'm
> running mutt-1.5.6

>From the fine manual:
       Note: the send-hook's are only executed ONCE after getting the initial 
list of
       recipients.  Adding a recipient after replying or editing the message 
will NOT
       cause any send-hook to be executed.  Also note that my_hdr commands 
which mod-
       ify recipient headers, or the message's subject, don't have any effect 
on the
       current message when executed from a send-hook.

You could replace $sendmail by a wrapper to add a BCC to your address.
Something like this(untested):
#!/bin/sh

hp=false
r=false
for i in "$@"; do
        if $r && expr "$i" : '.*hp'; then
                hp=true
        fi
        if [ "$i" == -- ]; then
                r=true
        fi
done

if $hp; then
        set -- "$@" "your hp address"
fi

exec sendmail "$@" 
----------snip----------


Nicolas