Subject: Re: Probably a newbie question (but you know about those man pages...)

From: [email-masked] (David W. Tamkin)
Date: Wed, 4 Jan 1995 15:57:12 -0600 (CST)

Jeremy Mathers asked,

| What is the standard way to run a file full of mail messages through
| your .procmailrc file?
| 
| I came up with:  formail -s procmail -m .procmailrc < mySavedMail
| 
| Can I do better?

Not much.  You can leave off "-m .procmailrc" because procmail will look for
~/.procmailrc by default.  "formail -s procmail < mySavedMail" should be enough.

One MAJOR caution: do not attempt that with input from a file to which proc-
mail will be appending messages, or it will repeat them until you kill it.

[1] If possible, mv or cp mySavedMail to some folder name to which procmail
    never writes and then feed it under the safe name to formail -s.

[2] If that is impossible, you can reduce the effect greatly by adding the -n
    option to formail:

    formail -ns procmail < mySavedMail

    That often, depending on a lot of different circumstances, will cut
    repetitions down to zero or at least to very few.

[3] You can also stop it altogether by adding this loop detector at the top
    of your .procmailrc:

   :0h
   * ^X-Loop: already been through procmail
   { HOST=garbagedump }

   and adding the loop marker when you process the folder:

 formail -A "X-Loop: already been through procmail" -ns procmail < mySavedMail

   and then remove that extra recipe from your rcfile.  

#1 and #3 are both bullet-proof, but #1 is far simpler to carry out.  #2 is
the easiest of all but can result in *some* repetitions.