Farhan Ahmed <[EMAIL PROTECTED]> writes: > Jorge Almeida wrote: >> On Thu, 22 Jun 2006, Jamie wrote: >> >The emails are sitting in individual files in a Maildir on the machine >> >that should have processed them. Is there any way to run procmail over >> >all of the messages in the Maildir so I don't have to manually forward >> >each message back to myself so that procmail will process them when the >> >come back in. >> >> procmail [-m /path/to/your/procmailrc] < /path/to/message >> >> This will deliver the message contained in the individual file >> /path/to/message. You'll have to iterate over all such files. > > Will this work for mbox format as well?
To answer your question... yes it should. There is an example of how to process missed mail or reprocess misprocessed mail in `man procmail' . Look for the paragraph that begins: Procmail can also be invoked to postprocess an already filled system mailbox. This can be useful if you don't want to or can't use a $HOME/.forward file (in which case the following script could periodi- cally be called from within cron(1), or whenever you start reading mail): [...] Nice example follows that para. Depending on scale you may want to do a little more and setup a sandbox for procmail experiments and runs of procmail outside the normal setup. Its pretty easy to do. Then you can run test runs and see exactly what will happen. Once happy with results then run with your normal .procmailrc. Such a setup might look like: mkdir -p proc/spool cd proc create a procrc file that has this header: cat ./procrc ----- 8< snip ------- PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin SHELL=/bin/sh MAILDIR=/home/YOU/proc/spool LOGFILE=/home/YOU/proc/.prclog ORGMAIL=/home/YOU/proc/spool/$LOGNAME DEFAULT=$ORGMAIL VERBOSE=YES #################################### ####### Test recipes below here ############ ----- 8< snip ------- Add the rules from your working rc file. What the above settings will do is: `MAILDIR=/home/YOU/proc/spool' sets the spool to be written to at the spool directory in your test area. So a rule like: 0: * ^To:[EMAIL PROTECTED] me Will write any mail with To: [EMAIL PROTECTED] to /home/YOU/proc/spool/me The point here is that you can now run test procmail runs without fear of writing to working mail spool. Stuff will be deliverd to your test area instead. `ORGMAIL=/home/YOU/proc/spool/$LOGNAME' Would normally be set to /var/spool/mail/$LOGNAME (by default) But now is set to your practice area `DEFAULT=$ORGMAIL' Sets the default delivery point in case something doesn't match any rules it goes to $ORGMAIL `VERBOSE=YES' Kind of speaks for itself... will put more usefull info in /home/YOU/proc/.prclog Now you can cd to the unprocessed mail directory and if it is one msg per file you could just cat it all together int ./bigcat (Assuming it has a leading `From .........' line and will compile like a large mbox file.) Or if alread in mbox format then you make test runs like this: cat MailToProcess| formail -e -s procmail -m /home/YOU/proc/procrc (formail -e is added to handle the case where messages do not have a separating blank line.) In the above command and with the posted procrc (with your rules) mail will be processed like usual but deliverd to your test area instead of to real working spool. This way you can iron out any bugs before you make the real run where you would just substitute the normal working rc file for ./procrc. -- gentoo-user@gentoo.org mailing list