From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1FvCgo-0000h4-NC for garchives@archives.gentoo.org; Tue, 27 Jun 2006 12:29:11 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.7/8.13.6) with SMTP id k5RCRn4l030912; Tue, 27 Jun 2006 12:27:49 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by robin.gentoo.org (8.13.7/8.13.6) with ESMTP id k5RCMMnV027413 for ; Tue, 27 Jun 2006 12:22:23 GMT Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 241FE64DD3 for ; Tue, 27 Jun 2006 12:22:22 +0000 (UTC) Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 27425-15 for ; Tue, 27 Jun 2006 12:22:15 +0000 (UTC) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id 7638264DE5 for ; Tue, 27 Jun 2006 12:22:14 +0000 (UTC) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FvCZc-000127-Bj for gentoo-user@gentoo.org; Tue, 27 Jun 2006 14:21:45 +0200 Received: from adsl-68-78-37-5.dsl.emhril.ameritech.net ([68.78.37.5]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Jun 2006 14:21:44 +0200 Received: from reader by adsl-68-78-37-5.dsl.emhril.ameritech.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Jun 2006 14:21:44 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-user@lists.gentoo.org From: reader@newsguy.com Subject: [gentoo-user] Re: OT: Any way to run files through procmail? Date: Tue, 27 Jun 2006 07:20:38 -0500 Organization: Still searching... Message-ID: <87veqmssbt.fsf@newsguy.com> References: <20060622180300.GA7914@gentoo> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: adsl-68-78-37-5.dsl.emhril.ameritech.net User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:mWPQ0Fvhi+vu+Rn0km+P9c+LNYw= Sender: news X-Virus-Scanned: amavisd-new at gentoo.org X-Spam-Status: No, score=-1.657 required=5.5 tests=[AWL=-0.019, BAYES_00=-2.599, NO_REAL_NAME=0.961] X-Spam-Score: -1.657 X-Spam-Level: X-Archives-Salt: 65e0af11-4908-4b5a-a178-65884e341ee4 X-Archives-Hash: 3e9d9ef90f4347ef8d2c9e5e1b7a91ba Farhan Ahmed 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:.*me@some\.com me Will write any mail with To: me@some.com 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