Hi Patrick,

On Thu, May 02, 2013 at 08:28:15AM -0400, Patrick Shanahan wrote:
> * Suvayu Ali <fatkasuvayu+li...@gmail.com> [05-02-13 04:31]:
>  [...]
> > Note that I do not have any default send-hook set.  I also have the
> > following reply-hooks so that I can automatically reply with the correct
> > from address based on which account the email was delivered to.
> > 
> >   reply-hook . my_hdr From: perso...@gmail.com
> >   reply-hook '~h "Delivered-To: +list@gmail\.com"' my_hdr From: 
> > "l...@gmail.com"
> >   reply-hook '~h "Delivered-To: +me@work1\.com"' my_hdr From: m...@work1.com
> >   reply-hook '~h "Delivered-To: +me@work2\.com"' my_hdr From: m...@work2.com
> > 
> > Now my problem is the default reply-hook above overrides the from
> > address set by reverse_name=yes.  If I comment it out, then the from
> > address is what was set by the last "my_hdr From: ..." command in the
> > above hooks.  I want it to be my personal address.
> > 
> > Any ideas how to resolve this conflict between hooks and reverse_name?
> 
> Reading "man muttrc" reply-hook discussion might help you.  It explains
> the usage:
>    reply-hook [!]pattern command
>        When replying to a message matching pattern, command is executed. 
>        When multiple reply-hooks match, they are executed in the order in
>        which they occur in the configuration file, but all reply-hooks are
>        matched and executed before send-hooks, regardless of their order
>        in the configuration file.
>                                                 
> Note that *all* matching reply hooks are "matched and executed before
> send-hooks, reguardless ...", and you can have *only* one From: address. 
> I would guess that in your case the From: address selection is somewhat
> arbitrary from the conditions you set and settless to your default.           
>                                      
> 
> I would suggest using "send-hook", and set a default, to accomplish your
> desires.  Further reading of the mutt and muttrc man pages will help.

I have gone through all the sections you mention.  If I use the
send-hook to set the default, then all the matching I do with the
reply-hooks above get overwriten.  I can't do the same matching in a
send-hook since it does not support a '~h <hdr_pattern>' matches.  I
think that is reasonable, since send-hook matches the outgoing message.
My understanding of email headers is very limited.  Do you know of
anyway I can match this in a send-hook?  Or maybe I should try a
send2-hook?  As far as I understood the manual, the order of hook
evaluation is: reply-hook, send-hook, send2-hook.

Thanks for your input.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

Reply via email to