ifile-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ifile-discuss] Re: Maildir format


From: Brett Nemeroff
Subject: Re: [Ifile-discuss] Re: Maildir format
Date: Wed, 14 May 2003 10:11:26 -0400 (EDT)
User-agent: SquirrelMail/1.4.0

Clemens, Sorry about the dup posting. I have a very sensitive send button
that triggered before I was ready!

Hey Guys,
I appreciate your help on this. I have a couple of comments. I'm kinda new
to procmail and I'm not a wiz on shell scripts, so I might need a hand
here..

So I'm looking at Jack's original refile.learn script on my server. I'm
going to try to comment it so I can understand what's going on. If I'm
wrong, can you please correct me? I'd rather understand what's going on
than just simply ask you guys for the new scripts....
------------ refile.learn --------------------------
#!/bin/bash
source /etc/profile
source $HOME/.bashrc

MAILDIR=$HOME/Maildir/
BACKUP=$HOME/.backupmail

#If $BACKUP dir dosen't exist, make it
[ ! -d $BACKUP ] && mkdir $BACKUP

#Step through the $MAILDIR file by file (
#QUESTION: Will this work for MAILDIR since it uses [dot]MailboxName format?
# Perhaps it should be:
# for mbox in $(ls -a $MAILDIR/)
# However that has extra stuff as well in it (. and ..)
for mbox in $(ls $MAILDIR/)
do
# If the current Mailbox exists then...
        if [ -f $MAILDIR/$mbox ]
        then
# Create a Backup
# This won't work in Maildir since Maildir uses
# "cur" "new" and "tmp" folders. A recursive copy should fix this? #
# Perhaps: cp -aR $MAILDIR/$mbox $BACKUP/$mbox || exit
                cp $MAILDIR/$mbox $BACKUP/$mbox || exit
# Reprocess mailboxes, creating newly processed mboxes with a .new extension
# This entire structure seems to need to be replaced. During ther
mid-stage # of the reclassification, it should write a <message>.new
instead of a
# <folder>.new, right? We'll have to take a look at the procmail file
# and see what's going on there as well...
                formail -s procmail -m FOLDER=$mbox
$HOME/bin/refile.learn.rc <
$MAILDIR/$mbox
# If there is a new MBOX and if it's any different, then overwrite the
# old MBOX
                if [ -f $MAILDIR/$mbox.new ]
                then
                        diff $MAILDIR/$mbox.new $MAILDIR/$mbox >/dev/null
2>/dev
/null || mv $MAILDIR/$mbox.new $MAILDIR/$mbox
# If there was a .new MBOX, get rid of it, we're done with it.
                        [ -f $MAILDIR/$mbox.new ] && rm -f $MAILDIR/$mbox.new
                fi
        fi


done
--------------------------------------
Question, I'm assuming here that the script waits for the execution of the
procmail command to complete before continuing?? Seems like it would have
to for this to work...


Ok, on the RC script, I started making some Maildir changes...
--------------refile.learn.rc---------------
SHELL = /bin/sh

MAILDIR=$HOME/Maildir/

#Put stuff already filed by ifile into the "new" (temp) folder
:0:
* $ ^X-Ifile-Hint: $FOLDER
.$FOLDER.new/

# Put stuff refiled by ifile into the temp folder
# Question, why would this rule catch anything? Shouldn't the previous rule
# catch everything for here? Or are we just populating $FOLDER?
:0:
* $ ^X-Ifile-Learned-To: $FOLDER
.$FOLDER.new/

# relearn message
:0 wc
* ^X-Ifile-Hint: \/.+
| $HOME/bin/ifile.relearn.message $MATCH $FOLDER 2>/dev/null

# add (change?) heading to reflect that it's been learned
# I have no idea how this changes for Maildir... Arn't individual mesages
# passed right here from procmail? why is a formail necessary?
        :0 Af
        | formail -I "X-Ifile-Learned-To: $FOLDER"

# I'm not sure about this guy.. maybe file refiled stuff into the temp folder
        :0 A:
        .$FOLDER.new/

# Catch unfiled emails (not touched by ifile), or just "other" emails..
:0:
.$FOLDER.new/
--------------------------------------------


So can you guys give me a little direction based on my comments. I'm going
to spend a little time looking over some procmail docs to see what I can
figure out.. but mainly I have questions about how to process the
individual files and to recurse (not sure if recursing is entirely
necessary, or just going into those "new" "cur" and "tmp" dirs..) into the
subdirs in the Maildir format.. So mainily what to do with the formail
statements.. You gave me one of the formail replacements, what do I need
to do with this other one??

Thanks!!
Brett





> Jack Bertram <address@hidden>:
>
>>> how about "cat $MAILDIR/cur/* | procmail ..."  :) ?
>>
>> This will feed all the messages into one procmail process, rather than
each message into a separate process.  I suppose this is possible, but
it's not the behaviour in the original script.
>
> you're right, i was focusing on the unneccessary ls(1), so i should have
written:
>
>   for msg in $MAILDIR/cur/*; do cat $msg | procmail -m FOLDER =$MAILDIR
> bin/refile.learn.rc; done
>
> btw, since i don't let a bayesian tool sort raw emails into several
folders anymore, i only need it for spam/ham refiling.  such a tool
should read base64 and be prepared to digest entire mboxes: for this
bogofilter.sf.net seems quite good.  i just wish it had the simple
database from ifile, because it seems more trouble than benefit to
employ the BErkeleyDB for this.  also one could do the classifying "just
in time", ie. right before mail-browsing than as part of mail delivery
itself.  this would also enable users to setup their own filtering.
>
> so what bogofilter essentially does for me is decoding base64.  to bad
there's no uncomplicated tool to do this separately.  i gleaned from a
similiar discussion on gmane.org that such a tool is hard to come by and
quite voluminous.  (sigh).
>
> i only know that the metamail tool doesn't cut it, because it can't
decode RFC-encoded umlauts in RFC822 headers (tried it and failed).
>
>   clemens
>
>
> _______________________________________________
> Ifile-discuss mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/ifile-discuss
>
>







reply via email to

[Prev in Thread] Current Thread [Next in Thread]