l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
November 4: Social gathering
Next Installfest:
TBD
Latest News:
Oct. 24: LUGOD election season has begun!
Page last updated:
2002 Sep 26 15:28

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] How to apply procmail filters to existing mailbox?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] How to apply procmail filters to existing mailbox?



hi graham,

begin Graham Freeman <graham@calteg.org> 
> 
> Howdy,
> 
> About 2 weeks ago I broke my procmail filters in such a way that they
> started silently discarding most of my e-mail for about 6 hours

OMG!  i've always found that procmail is _really_ good about having the
least destructive default action.   that's AWFUL.

> until I
> discovered the problem and (for lack of time) disabled all my procmail
> filters.  Fortunately I retained the mail server logs, so I can probably
> figure out at least whose e-mail I missed.

fwiw, whenever i make a change to my procmail filter, i always send test
msgs to make sure it works.  there are fancy shmansy ways of doing this,
but telnetting to your SMTP port and sending email with various From:
and Subject: lines works for me.  i don't test everything, but it at
least a few test emails ups my confidence that i haven't made a huge
error.

> Now that I've been able to find & fix the problem with my filters, I need
> some way to apply the filters to the ~3,000 unfiltered messages that wound
> up in my inbox since then.  I'd really prefer not to have to go through
> these messages by hand.  Unfortunately, all the procmail documentation I
> can find assumes that you're using it only as the e-mail comes in, not on
> an existing mailbox.
> 
> Can anyone tell me how to apply my existing .procmailrc to my existing
> /var/mail/graham inbox file?
 
sure.

cp /var/mail/graham graham.backup
mv /var/mail/graham graham.old
formail -s procmail <  graham.old 

the -s option causes standard input to be split into separate emails,
and then feed them individually to the program specified immediately
after the -s option.

the reason why you have to move /var/mail/graham to graham.old is
because email taken from /var/mail/graham which doesn't match a recipe
is sent to your default mailbox, which happens to be right back into
/var/mail/graham.

a nice endless loop.

the reason for the first "cp" is "just because".  it's a good idea.  :)

hth,
pete
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.