Does anybody know how to remove duplicates messages from a mail-file
using procmail or another mail filter ?
That depends on how you detect duplicates. I use the following filter; it
detects duplicate messages based on the Message-ID header. I send
duplicates to a special folder, which is cleaned out regularly via a cron
job. I've never had a problem with it.
DUPE_DEST=dupes/. # For duplicate messages
IDCACHE_LEN=8192 # Size of message ID cache
IDCACHE_FILE=$HOME/.idcache # message ID cache file
:0h
FROM=|$FORMAIL -rtz -x "To:"
LOCKFILE=$IDCACHE_FILE.lock
:0H
* ^Message-ID:
* ? formail -D $IDCACHE_LEN $IDCACHE_FILE
{
LOG="dupecheck: discarded $MESSAGEID from $FROM
"
:0
$DUPE_DEST
}
LOCKFILE
---
Lars Kellogg-Stedman * lars(_at_)bu(_dot_)edu * (617)353-8277
Office of Information Technology, Boston University