procmail
[Top] [All Lists]

Re: run procmail against existing folders

2001-01-24 11:55:20
At 03:51 2001-01-24 +0000, Philip Olson wrote:

I made a few new rules and want to run my new rules against a few
existing folders, such as INBOX, as to "become current."  How can this be
done? ALL advice welcome.  Am using standard unix pool format (pine).

1. Move your existing mailboxes to a new location. This is extremely important.

2. execute:
        formail -s procmail < oldboxes\mailbox

This splits the mailbox up into individual messages each of which is handed to procmail, which lacking a '-m recipefile' argument (which one might normally use when executing procmail via formail), will execute the .procmailrc

Procmail will do whatever it has been scripted to do with the message, possibly emitting the message back into the original file where the message would have been sourced from (like "inbox" or whatever you've named it), which is part of the reason you want to MOVE the files first - otherwise you end up with a loop. The other two predominant reasons are to avoid duplicates (old, unfiltered messages at the beginning of the mailbox file, and new, filtered ones simply tacked onto the end), as well as keeping messages in some semblance of order.

If procmail is set up to be invoked for all new mail, note that new mail arriving while you're running the formail process will be inserted into the mailbox files at the point at which it arrived (whole messages only, so you're not looking at a corruption problem - unless you're not locking your mailboxes in the filters). The workaround would be to rename your .procmailrc and execute procmail on the renamed version (new arrivals would just go to your mail spool), then when done with your refiltering, run the process on your system mailbox, followed by renaming your .procmailrc back. That should do it more or less.

I did research how to do this, came up empty.

Uhm, try looking harder. The basic formail invocation above *IS* covered in the Procmail mini-faq (linked from <http://www.procmail.org/> of all places). Look at the first question under "Unrelated quick questions".

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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