Hi, void wrote: > I have various mailing list emails filtered on the server > by the mail provider going into various imap folders, based > on various properties of the email, like List-Id: for example. > > What I'd like to have within mutt is for it to dynamically > decide which signature file to use based on what imap > folder the mail being replied to is in. > > In the .muttrc there's for example a line like this: > > mailboxes =mutt-users =test > > In the manual, the nearest thing I can find to do what > I'm describing is in "Example 3.8. Using MuttLisp expressions" > but I'm unsure what expressions to use for an imap folder, > how to test to see if mutt is in it.
A folder-hook will do this job nicely¹. It is uner the
heading "Setting Variables Based Upon Mailbox" and described
as:
It is often desirable to change settings based on which
mailbox you are reading. The folder-hook command
provides a method by which you can execute any
configuration command. regexp is a regular expression
specifying in which mailboxes to execute command before
loading. If a mailbox matches multiple folder-hooks,
they are executed in the order given in the .muttrc.
Here's an example for setting the signature:
folder-hook . 'set signature=~/.sigs/default'
folder-hook =mailbox-a 'set signature=~/.sigs/mailbox-a'
You set the first one as default so that after you change
from mailbox-a you aren't left with the signature you set
for that mailbox.
Often, you may have other variables to set based on the
folder/mailbox and rather than set them all you can use a
folder-hook to source a file which containsd them all, e.g.:
folder-hook . 'source ~/.mutt/profiles/default'
folder-hook =mailbox-a 'source ~/.mutt/profiles/mailbox-a'
¹ http://www.mutt.org/doc/manual/#folder-hook
HTH,
--
Todd
signature.asc
Description: PGP signature
