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

Re: send-hook not setting $from



* Eugene Lee <list-mutt@xxxxxxxx> [12-06-03 20:16]:
> On Fri, Dec 05, 2003 at 07:28:11AM -0500, David Yitzchak Cohen wrote:
 [much snipped ...]
> > > Michael (and Noir), thanks for your comments.  I know that my_hdr works.
> > > But I don't understand why "set $from" does not work in a send-hook.
> > 
> > In plain English, changing $from in a send-hook has no effect on the
> > message being composed because Mutt has already set your From> header
> > before it executes the send-hook (based on what $from was then - i.e.,
> > before your hook was called).
> 
> This behavior is not explained in the normal HTML documentation.

but it is (reading & comprehension are necessary):

3.17.  Change settings based upon message recipients
  
Usage: reply-hook [!]pattern command Usage: send-hook [!]pattern command
      
These commands 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.
              
reply-hook is matched against the message you are replying to, instead of
the message you are sending.  send-hook is matched against all messages,
both new and replies.  Note: reply-hooks are matched before the
send-hook, regardless of the order specified in the users's configuration
file.
                        
For each type of send-hook or reply-hook, When multiple matches occur,
commands are executed in the order they are specified in the muttrc (for
that type of hook).
                              
See `Message Matching in Hooks'' for information on the exact format of
pattern.
                                  
Example: send-hook mutt "set mime_forward signature=''"
                                    
Another typical use for this command is to change the values of the
`$attribution'', `$signature'' and `$locale'' variables in order to
change the language of the attributions and signatures based upon the
recipients.
      
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 modify recipient headers, or the message's subject,
don't have any effect on the current message when executed from a
send-hook.
                  
                  

> > my_hdr works because it simply replaces
> > any existing header by the same name - in this case, the "From> " header.
> > 
> > > The docs mention nothing.
> > 
> > The docs specifically mention that changing $from has no effect on the
> > current message from within send-hooks.
> 
> I can't find anything in the docs that support this statement, even
> though your statement is true.  :-(  In fact, the docs only have a
> statement about using my_hdr:
> 
>       http://www.mutt.org/doc/manual/manual-3.html#send-hook

~> less /usr/local/doc/mutt/manual.txt

Why look for doc's on the web when they exist on your local boxen?

> I must be blind, because I cannot find anything in the docs that even
> predicts this behavior.  Could you possible provide a link to the blurb
> in the docs that says so?

see above....
-- 
Patrick Shanahan                        Registered Linux User #207535
http://wahoo.no-ip.org                        @ http://counter.li.org