PMDIR=$HOME/.procmail
:0 Whc: msgid.lock
| formail -D 4096 $PMDIR/idcache
:0 a:
Mail/duplicates
:0 Whc: msgid.lock This sends the headers to formail and makes a carbon copy of the mail and creates a lock file while we are doing this. | formail -D 4096 $PMDIR/idcache This pipes the output of the previous line to formail, formail will append the msgid of the message to the file idcache if it doesn't already exist. If the msgid exists, then it will exit with success, if it does not then it will append the msgid to the file (removing anything over 4096 bytes) and return failure. :0 a: We use the a: to see if there was success on the previous rule. Mail/duplicates We then send the message to the folder Mail/duplicates. We could send to /dev/null, but I'm too chicken for that...