procmail
[Top] [All Lists]

Re: Deleting certain dups

1998-04-12 13:33:06
On Sat, 11 Apr 1998 23:03:46 -0400 (EDT), "David S. Jackson"
<dsj(_at_)dsj(_dot_)net> wrote:
:0 Wh: msgid.lock
| formail -D 8192 msgid.cache

This works by examining +all+ messages and throwing away the ones
we've already seen. That is, all messages you want formail to keep
track of have to be entered into the cache. What you want to do with
them then is a different matter, though.
  The above works by formail "pretending" it's "saved" a message when
it sees it was already present in the cache before. Procmail senses
this, and considers the message delivered. Since formail didn't
actually save the message anywhere, the duplicate message is basically
lost. To reiterate: For all Procmail knows, formail must have saved it
somewhere safe. 
  If you want to lose things selectively, you can't rely on this
trick. You can, however, rig a different sort of recipe which
explicitly saves duplicates to /dev/null based on formail's cache
status: 

    :0Wh:msgid.lock
    * ? formail -D 8192 msgid.cache
    /dev/null

This can now easily be adapted according to your wish:

is add a condition that only emails coming from "@wtic.net" may be
deleted.  How could I modify this recipe so that only the @wtic.net
messages would be vanquished?

That's easy now:

    :0Wh:msgid.lock
    * ? formail -D 8192 msgid.cache
    * ^From:(_dot_)*(_at_)wtic\(_dot_)net\>
    /dev/null

This obviously leads to the situation that when the wtic.net copy
arrives +before+ the other one, you will still get a duplicate.
Perhaps a better solution would thus be to simply save the wtic ones
to a different folder entirely, or even (gasp) throw them away
altogether.

/* era */

Note that the order of the condition lines in the second recipe are
significant. You have to have the formail condition first because
everything still relies on formail being run on +every+ message.

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

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