Discussion:
Need some help with send-hook and folder-hook, their order in muttrc
Chris Green
2017-11-07 10:17:04 UTC
Permalink
I want messages sent from one particular folder to have a different
From: address.

Currently the only settings I have in my muttrc that affect the From:
address are:-

send-hook . 'my_hdr From: Chris Green <***@isbd.co.uk>'
...
...
send-hook ~l 'my_hdr From: Chris Green <***@isbd.net>'


I use the ***@isbd.net address for all my mailing lists.


I'd like to make it so that when I'm in a particular folder (which
will probably be called 'cl') my From: address will also be
***@isbd.net.

So I need to add something like:-

folder-hook cl 'my_hdr From: Chris Green <***@isbd.net>'

However I'm a little unclear what else I need, do I need something
like:-

folder-hook . 'my_hdr From: Chris Green <***@isbd.co.uk>'

and does it go before or after the specific 'cl one? Plus, do these
two settings make the send-hook setting of my From: address redundant?
I still need the 'send hook ~l....' one of course.
--
Chris Green
Ian Zimmerman
2017-11-07 16:49:06 UTC
Permalink
Post by Chris Green
I'd like to make it so that when I'm in a particular folder (which
will probably be called 'cl') my From: address will also be
So I need to add something like:-
However I'm a little unclear what else I need,
If you use my_hdr in folder hooks at all, you probably need something
like this line, from my own .muttrc:

folder-hook . "unmy_hdr to from reply-to bcc newsgroups x-loosely-listed"

From my experience, you'll never be able to keep track of them
individually and add the return-to-default hook for each header separately.
--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet, fetch the TXT record for the domain.
Chris Green
2017-11-07 18:01:25 UTC
Permalink
Post by Ian Zimmerman
Post by Chris Green
I'd like to make it so that when I'm in a particular folder (which
will probably be called 'cl') my From: address will also be
So I need to add something like:-
However I'm a little unclear what else I need,
If you use my_hdr in folder hooks at all, you probably need something
folder-hook . "unmy_hdr to from reply-to bcc newsgroups x-loosely-listed"
Post by Chris Green
From my experience, you'll never be able to keep track of them
individually and add the return-to-default hook for each header separately.
OK, it seems to get rather messy.

I think it may be easier to have a macro which

Changes my_hdr
Sends the message
Changes my_hdr back
--
Chris Green
David Woodfall
2017-11-07 21:32:09 UTC
Permalink
Post by Chris Green
Post by Ian Zimmerman
Post by Chris Green
I'd like to make it so that when I'm in a particular folder (which
will probably be called 'cl') my From: address will also be
So I need to add something like:-
However I'm a little unclear what else I need,
If you use my_hdr in folder hooks at all, you probably need something
folder-hook . "unmy_hdr to from reply-to bcc newsgroups x-loosely-listed"
Post by Chris Green
From my experience, you'll never be able to keep track of them
individually and add the return-to-default hook for each header separately.
OK, it seems to get rather messy.
I think it may be easier to have a macro which
Changes my_hdr
Sends the message
Changes my_hdr back
--
Chris Green
What I do is have a hooks file which runs other hooks files depending
on the folder:

My .mutt/hooks:

folder-hook 'imaps://domain/.*' source ~/.mutt/default
folder-hook =lists/* source ~/.mutt/listhook

My .mutt/default

my_hdr From: David Woodfall <***@somedomain.net>
set sort=threads

My .mutt/listhook:

set collapse-all
set sort=threads
my_hdr From: David Woodfall <***@dawoodfall.net>

The default file will set the header back after it has been changed in
the lists folder.
Chris Green
2017-11-10 10:41:07 UTC
Permalink
Post by David Woodfall
Post by Chris Green
Post by Ian Zimmerman
Post by Chris Green
I'd like to make it so that when I'm in a particular folder (which
will probably be called 'cl') my From: address will also be
So I need to add something like:-
However I'm a little unclear what else I need,
If you use my_hdr in folder hooks at all, you probably need something
folder-hook . "unmy_hdr to from reply-to bcc newsgroups x-loosely-listed"
Post by Chris Green
From my experience, you'll never be able to keep track of them
individually and add the return-to-default hook for each header separately.
OK, it seems to get rather messy.
I think it may be easier to have a macro which
Changes my_hdr
Sends the message
Changes my_hdr back
--
Chris Green
What I do is have a hooks file which runs other hooks files depending
Ah, now that's clever, it might well do exactly what I need in a way
that I can understand, thanks.
Post by David Woodfall
folder-hook 'imaps://domain/.*' source ~/.mutt/default
folder-hook =lists/* source ~/.mutt/listhook
My .mutt/default
set sort=threads
set collapse-all
set sort=threads
Thanks for that, it looks very close to the sort of thing I want to do.
--
Chris Green
Jason
2017-11-11 17:27:33 UTC
Permalink
Post by Chris Green
I want messages sent from one particular folder to have a different
From: address.
address are:-
...
...
I'd like to make it so that when I'm in a particular folder (which
will probably be called 'cl') my From: address will also be
So I need to add something like:-
However I'm a little unclear what else I need, do I need something
like:-
and does it go before or after the specific 'cl one? Plus, do these
two settings make the send-hook setting of my From: address redundant?
I still need the 'send hook ~l....' one of course.
Couldn't you just do something like this:

folder-hook . 'set from=***@isbd.co.uk; set realname="Chris Green"'
folder-hook /path/to/cl 'set from=***@isbd.net; set realname="Chris Green"'

The first line sets the default and the second line sets it for the cl
folder. Although I'm not sure how this interacts with your send-hook
lines; maybe you'd need to remove the 'send-hook . ' line.
--
Jason
Loading...