From: reader@newsguy.com
To: gentoo-user@lists.gentoo.org
Subject: [gentoo-user] Re: OT: Any way to run files through procmail?
Date: Tue, 27 Jun 2006 07:20:38 -0500 [thread overview]
Message-ID: <87veqmssbt.fsf@newsguy.com> (raw)
In-Reply-To: 20060622180300.GA7914@gentoo
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
prev parent reply other threads:[~2006-06-27 12:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` reader [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87veqmssbt.fsf@newsguy.com \
--to=reader@newsguy.com \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox