public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] OT: Any way to run files through procmail?
@ 2006-06-22  4:35 Jamie
  2006-06-22  9:12 ` Jorge Almeida
  0 siblings, 1 reply; 5+ messages in thread
From: Jamie @ 2006-06-22  4:35 UTC (permalink / raw
  To: gentoo-user


Due to some "layer 8" issues (ie. me) my Procmail rules did not work for
a 24 hour period and I have almost 700 emails that have not run through
my filters.
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.

Thanks

Jamie

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] OT: Any way to run files through procmail?
  2006-06-22  4:35 [gentoo-user] OT: Any way to run files through procmail? Jamie
@ 2006-06-22  9:12 ` Jorge Almeida
  2006-06-22 18:03   ` Farhan Ahmed
  0 siblings, 1 reply; 5+ messages in thread
From: Jorge Almeida @ 2006-06-22  9:12 UTC (permalink / raw
  To: gentoo-user

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.
-- 
Jorge Almeida
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] OT: Any way to run files through procmail?
  2006-06-22  9:12 ` Jorge Almeida
@ 2006-06-22 18:03   ` Farhan Ahmed
  2006-06-23 10:51     ` Alexander Skwar
  2006-06-27 12:20     ` [gentoo-user] " reader
  0 siblings, 2 replies; 5+ messages in thread
From: Farhan Ahmed @ 2006-06-22 18:03 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

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?

Thanks in advance,
Farhan Ahmed
-- 
Place		:  Bangalore, Karnataka, India
GPG Key		:  8BE90E98
WengoPhone ID	:  farhanahmed
IRC Nick	:  farhanahmed / farhanahmed06 (irc.freenode.net)
Check Out       :  http://gentooisbest.blogspot.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] OT: Any way to run files through procmail?
  2006-06-22 18:03   ` Farhan Ahmed
@ 2006-06-23 10:51     ` Alexander Skwar
  2006-06-27 12:20     ` [gentoo-user] " reader
  1 sibling, 0 replies; 5+ messages in thread
From: Alexander Skwar @ 2006-06-23 10:51 UTC (permalink / raw
  To: gentoo-user

Farhan Ahmed wrote:
> Jorge Almeida wrote:

>> 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?

No. For this, you should use something like formail. It's part of
procmail, IIRC.

Alexander Skwar
-- 
The Golden Rule of Arts and Sciences:
	He who has the gold makes the rules.
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-user]  Re: OT: Any way to run files through procmail?
  2006-06-22 18:03   ` Farhan Ahmed
  2006-06-23 10:51     ` Alexander Skwar
@ 2006-06-27 12:20     ` reader
  1 sibling, 0 replies; 5+ messages in thread
From: reader @ 2006-06-27 12:20 UTC (permalink / raw
  To: gentoo-user

Farhan Ahmed <farhanahmed06@gmail.com> 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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-06-27 12:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-22  4:35 [gentoo-user] OT: Any way to run files through procmail? Jamie
2006-06-22  9:12 ` Jorge Almeida
2006-06-22 18:03   ` Farhan Ahmed
2006-06-23 10:51     ` Alexander Skwar
2006-06-27 12:20     ` [gentoo-user] " reader

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox