procmail
[Top] [All Lists]

RE: reprocessing mail

2001-12-04 15:46:06

Brad writes:
Sent: Tuesday, December 04, 2001 1:58 PM
To: procmail(_at_)Lists(_dot_)RWTH-Aachen(_dot_)DE
Subject: reprocessing mail


I had a script that would rum all mbox back threw my procmail filter
when i changed the .procmailrc file, but lost it some time ago. anyone
have a script that the can send me? or url that has one?


Q: If you reprocess your mail won't your procmail scripts re-file e-mails
that have already been filed?  That seems undesirable.

Although I don't have a ready-made script, here is an outline that you might
be able to work from.  The key points are that you need to make sure and
lock the mailbox first, then move it to a temporary file, then process the
temporary (old mail) file, remove it, and release the lock.

THIS IS UNTESTED.

#!/bin/csh -f
lockfile -ml
if ($status != 0) then
  echo "attempt to lock $MAIL failed."
  exit 2
endif
if (-e $MAIL) then
  mv $MAIL ${MAIL}.old
  formail -s procmail < ${MAIL}.old
  rm -f ${MAIL}.old
endif
lockfile -mu

If you have admin privieleges, I'd highly recommend creating a new user, and
testing this script under the new user id.  At a minimum, make sure that you
save away the original $MAIL file, as well as the contents of the entire
directory(-ies) where you file your mail before trying this out.  And note
the warning about mail being refiled - which is probably not what you want
to have happen.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>