procmail
[Top] [All Lists]

RE: how to apply a new recipe to already arrived messages?

2004-06-21 23:56:29

More than a FAQ, try "man procmail".

       Procmail  can  also  be invoked to postprocess an already filled
system
       mailbox.  This can be useful if you  don't  want  to  or  can't  use
a
       $HOME/.forward  file (in which case the following script could
periodi-
       cally be called from within cron(1),  or  whenever  you  start
reading
       mail):
              #!/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



____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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