sort a lot of inbox with mutt and ifile

Lionel Dricot <[email protected]> Tue, 7 Jan 2003 00:40:00 +0100
Newsgroups gmane.mail.ifile.general
Message-ID <20030106234000.GD8799@mars>
Hi,

I was using ifile with Martin Macock script's to filter my mails.  But,
instead of just sorting between "spam" and "good", I make somes macro to
sort mails between several categories.  each category has is own mailbox
(same name).

I ask Jack ( http://www.jbertram.net/projects/ifile/ifile.html ) of an
idea to build a script to generate ifile macro for mutt, and he did it ! Thx Jack !

If you have already ifile and martin macock scripts installed, it's
really easy !

Put the attached script in your /usr/local/bin or whatever you want,
create a .mailboxes in your home with, on each line : mymailbox:key

Example :

inbox:<f1>
friends:<f2>
work:<f3>
serieux:<f4>
...
mutt-user-fr:<Esc><f5>
debian-user-fr:<Esc><f6>
freevideo-list:<Esc><f7>
ifile-list:<Esc><F8>


Then remove (comment) all mailboxes line in your muttrc and put, in the
same muttrc

source "mutt_macro < /home/login/.mailboxes|"

Don't forget to "ifile.learn.mailbox mybox ~/mail/mybox" for each
mailbox !
(Perhaps try it with a new .idata)

Your procmailrc must be like this :

VERBOSE=off

MAILDIR=$HOME/Mail

:0 fBw 
| $HOME/bin/ifile.inject-learn.header

:0:
* ^X-Ifile-Hint: \/.+
$MATCH

(available on http://www.jbertram.net/resources/ifile/procmailrc)

Now, ifile will send you all mail in the good mailbox !  If it does
wrong, simply put the where you want to move the mail, ifile will learn
!
For example, if I have an ifile-list email in my inbox, when reading the
mail, I will press <Esc><F12>.  No more !

Hope that some people will use it !   A big thx to Jack for that.

Ploum
PS:sorry for my bad english, I'm belgian and I speak french

_______________________________________________
Ifile-discuss mailing list
[email protected]
http://mail.nongnu.org/mailman/listinfo/ifile-discuss
mutt_macro (text/plain, 437 B)
#!/usr/bin/perl

while (<>) {
        ($mailbox, $key) = split(/:/, $_);
        chomp $key;
        $key{$mailbox} = $key;
        push @mailboxes, $mailbox;	
}

foreach $mbox1 (@mailboxes) {
        foreach $mbox2 (@mailboxes) {
                print "folder-hook $mbox1 'macro pager $key{$mbox2} \"|ifile.relearn.message $mbox1 $mbox2\\ns=$mbox2\\n\\n\\t\" \"Relearn a\ $mbox2 \"'\n";
        }
print "mailboxes ~/mail/$mbox1 \n"
}