Howard Moftich asked,
| I somehow ended up with my entire mailbox having duplicate emails so I
| called on formail to the rescue.
|
| Invoked as:
|
| cat $MAIL | formail -ds procmail ~/procmail_scripts/rm_dups.proc
Youch ... save a cat:
formail -ds procmail ~/procmail_scripts/rm_dups.proc < $MAIL
| rm_dups.proc:
|
| MAILDIR=$HOME/Mail
| DEFAULT=$HOME/procmail_scripts/test_output
| #DEFAULT=/dev/null
| LOGFILE=$HOME/procmail_scripts/logfile
| VERBOSE=on
| :0 Wh: msgid.lock
| | formail -D 8192 msgid.cache
|
| Everything starts ok but after a bunch (~30) of emails, out of the
| blue formail starts returning (1)
The formail that is returning "1" is not the formail process reading your
mail at the command line; it's the one inside your rcfile that has the -D
option.
formail -D returns failure if the Message-Id: isn't already in the cache
(and adds it to the cache) and success if it already is. Apparently you're
feeding procmail a folder (split up by formail -s) that consists of about
thirty old letters whose ID's are already in the cache followed by some new
mail, so formail -D inside the rcfile succeeds thirty times (on the old mail
that it recognizes as duplicates) and then starts to return failure (on the
new mail that was not cached before).