procmail
[Top] [All Lists]

Re: Rescanning your inbox

1999-07-28 20:25:49
On Mon, 26 Jul 1999, Pete wrote:
Due to a few errors with my procmailrc file I have ended up with all 
my email in /var/spool/mail/plaven.

Is there anyway I can "rescan" that file to get the now working 
receipes to toss the email into their respectful folders?

In the procmail man page, towards the bottom, there is a nice script that does
what I believe you want done:

              #!/bin/sh

              ORGMAIL=/var/spool/mail/$LOGNAME

              if cd $HOME &&
               test -s $ORGMAIL &&
               lockfile -r0 -l1024 .newmail.lock 2>/dev/null
              then
                trap "rm -f .newmail.lock" 1 2 3 13 15
                umask 077
                lockfile -l1024 -ml
                cat $ORGMAIL >>.newmail &&
                 cat /dev/null >$ORGMAIL
                lockfile -mu
                formail -s procmail <.newmail &&
                 rm -f .newmail
                rm -f .newmail.lock
              fi
              exit 0

I have used it pretty regularly, as I add new bells and whistles to my
.procmailrc file.  About the only "gotcha" is, if you have to break in the
middle of the script, you could easily lose your mailbox contents, when the
script removes .newmail.  I have replaced the -f flag with and -if, to at least
ask if I really want to do that.

-------------------------------------------
E-mail: 
   Home:  steveh(_at_)iname(_dot_)com
-------------------------------------------


<Prev in Thread] Current Thread [Next in Thread>