Re: Setting the "From", depending on the Recipient
On 2003-11-14, Martin Hasenbein <mh-mutt@xxxxxxxxxxxx> wrote:
> Hoi,
>
> I have two questions and hope someone can help me with this?!
>
> 1. I've set up a few send-hooks to change my From:-line depending
> on who I send mail to:
>
> send-hook . 'my_hdr From: Martin Hasenbein <mh@xxxxxxx>'
> send-hook '~t @space.net' 'my_hdr From: Martin Hasenbein <mh@xxxxxxxxx>'
>
> send-hook '~C @hasenbein.com' 'my_hdr From: Martin Hasenbein
> <martin@xxxxxxxxxxxxx>'
>
> Now, if I send out an eMail to someone, the first From:-line is used.
> If I send an eMail to one of my colleagues (*@space.net), the second
> From:-line is used. And if I send an eMail to a member of my family
> (*@hasenbein.com), the third From:-line is used. That works perfect!
> But I also have defined some folder-hooks for e.g. the mailing-lists:
>
> folder-hook =mailings/mutt 'my_hdr From: Martin Hasenbein
> <mh-mutt@xxxxxxxxxxxx>'
> folder-hook =mailings/mutt 'set record=/home/mh/emails/archives/mutt-out'
>
> When I now change to the folder and try to send an eMail to this list,
> my From:-line doesn't change. It reminds "Martin Hasenbein <mh@xxxxxxx>".
> Why? Do send-hooks have a higher priority over folder-hooks? Or do I
> have to specify a send-hook for each mailing-list, I send eMails to?
It's not a matter of priority but of when the hooks are executed.
Folder-hooks are executed when you enter a folder. Send-hooks are
executed just before you compose a message.
In your case, the folder-hook was executed when you entered the
folder, but the send-hooks were still active, so they were also
executed when you sent the message.
If you want to use both folder-hooks and send-hooks to make
settings, you will probably need to nest them, with the folder-hooks
controlling which send-hooks are set, something like this:
folder-hook . unhook send-hook
folder-hook folder1 send-hook . 'my_hdr From: No Body <who@where>'
folder-hook folder1 send-hook "~t them" 'my_hdr From: No One <why@me>'
folder-hook folder2 'my_hdr From: No One <why@me>'
I'll leave it to you to figure out exactly the hooks you need, but
that should give you an idea of how to proceed.
HTH,
Gary
--
Gary Johnson | Agilent Technologies
garyjohn@xxxxxxxxxxxxxxx | Wireless Division
http://www.spocom.com/users/gjohnson/mutt/ | Spokane, Washington, USA