procmail
[Top] [All Lists]

Re: save to archive and delete

1999-06-11 03:58:05
On Fri, 11 Jun 1999 10:06:14 +0200, Jost Schaper <jost(_at_)schaper(_dot_)org>
wrote:
and a file /dev/null owned by root.root crwxr-xr-x
Procmail gives me the error: Error while writing to "dev/null"

Looks like you need a new computer :-)

to delete, and to save, try something like

"To delete, and to save" is a contradiction in terms. Unless you do
anything special (like a :c flag), Procmail has exactly one copy of
the message and when you've delivered that somewhere (saved or
forwarded) Procmail thinks it's done, and if the message wasn't really
"saved" upon delivery, it's "deleted".

MONTHFOLDER=`date +%y-%m`

(This can be optimized by grabbing the date from the From_ line. See
recent messages about this.)

:0 c:
* ^TOintern-list
${MAILDIR}/interne-liste/${MONTHFOLDER}
:0
* ^TOintern-list
/dev/null
# Problems, see above

So just lose the c flag on the first recipe and delete the second
recipe altogether.

(Another optimization, for other cases where you do need two recipes,
is to use an :A flag instead of check the same condition again, or
group the recipes in braces under a shared condition:

    :0
    * ^TO_intern-list
    {
        :0c
        whatever

        :0
        whatever-else
    }

And yes, you should probably be using ^TO_ instead of ^TO if your
Procmail version has that [post 3.11pre4 or so]).

/* era */

-- 
.obBotBait: It shouldn't even matter whether     <http://www.iki.fi/era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>
 * Sign the European spam petition! <http://www.politik-digital.de/spam/en/> *

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