procmail
[Top] [All Lists]

Re: postprocess a mailbox

1998-08-12 22:51:12
Michael McCaffrey is trying to post-process a mail folder with this rcfile:

| # Backup everything
| :0 c
| /home/herozero/ebox/testzone_backup.inbox
| 
| # Send all old messages to the bit bucket.
| :0
| * !^Date: .*Aug
| /home/herozero/ebox/null.inbox

as invoked from this script:

| #!/bin/sh
| 
| ORGMAIL=/home/herozero/ebox/procmail_list.inbox
| 
| 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 -m /home/herozero/ebox/procmail_list.rc <.newmail &&
|    rm -f .newmail
|   rm -f .newmail.lock
| fi
| exit 0

... and all mail not saved to null.inbox disappears.

Procmail's -m option unsets ORGMAIL (and in any case, even -p without -m,
I'm pretty sure that procmail will ignore any value of $ORGMAIL set outside
procmail unless it is set on procmail's command to the *right* of procmail's
own name, so that the assignment is a positional parameter rather than an
environmental setting in the calling shell) and I believe it unsets DEFAULT,
so mail that gets to the end of an rcfile that is called with -m has nowhere
to go unless DEFAULT is reassigned within the rcfile.

So my suggestion is either to give a value to DEFAULT in the rcfile or not
to use the -m option.

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