I was recently unsubscribed (I am subscribed again now), saw a message
from Bernard Massot in the archives, asking about folder-specific macros
for 'm', to send mail to the right participants.

He thought it would be a good idea to send this to the list, so here it is,
with a bit more tacked on the end, along with a question at the end.

---
What I do is admittedly a little complicated.

Procmail automatically creates folders for lists (ask for the recipe if
you want, I got it off the net somewhere...) and puts them in folders
like this: (Snipped output, but explanatory enough...)

apex:~/.Mail/lists$ ls
[EMAIL PROTECTED]/ [EMAIL PROTECTED]/
[EMAIL PROTECTED]/

I also have save hooks to save to the email address of the sender, and save
sent messages to that folder, if it exists. [ed note: appended on bottom]

What you want is here:

# These use macros to specify a default recipient for the folders it
# makes sense for.
folder-hook . 'macro index m "<mail>"'
folder-hook . 'macro pager m "<mail>"'
source "~/.mutt/hooks/folder.recip.sh ~/.Mail/lists/"|
source "~/.mutt/hooks/folder.recip.sh ~/.Mail/people/"|

With me so far?

~~/.mutt/hooks/folder.recip.sh is the following:

#!/bin/sh

# Generates folder-hooks of the form:
#
# folder-hook DIRNAME 'macro index m "<mail>DIRNAME<enter>"'


if [ $# -ne 1 ]; then
        echo "Usage: $0 name";
        exit 127;
fi

for i in $(ls $1);do
        echo "folder-hook $i 'macro index m \"<mail>$i<enter>\"'";
        echo "folder-hook $i 'macro pager m \"<mail>$i<enter>\"'";
done

# end


And there we have it.

# These generate fcc-save-hooks for each address/list that already has
# its own folder.
source "~/.mutt/hooks/save.sh ~/.Mail/lists/"|
source "~/.mutt/hooks/save.sh ~/.Mail/people/"|

save-hook . =people/%a


~~/.mutt/hooks/save.sh is this:

#!/bin/sh

# Generates fcc-save-hooks of the form:
# fcc-save-hook DIRNAME =DIR/ADDRESS

if [ $# -ne 1 ]; then
    echo "Usage: $0 name";
    exit 127;
fi

for i in $(ls $1);do\
    echo "fcc-save-hook $i =$(basename $1)/$i";\
done


And then that's done too. If you don't have a folder for a person, it
throws a message sent to them into record, if you do, it puts it in
there.


Now the question: Can I make these all case insensitive? For instance
right now things to [EMAIL PROTECTED] and [EMAIL PROTECTED] or [EMAIL PROTECTED] are all
treated differently, so with a mail sent to each of these addresses,
only the one that matches the folder name including case sensitivity
gets put there, the others go into record.

Thanks in advance.

Reply via email to