At 14:13 2002-01-07 -0500, Robert Dege wrote:
> 1 more question while we are at it... if I need to run the "procmailrc"
> rules against my existing folders, how do I do it?
I'm not sure if it can be done (easily at least). It might involve
re-sending the mail, or some sendmail command line syntax. IOW, I don't
know.
'existing folders' is a tad vague - please be clear as to mailbox or maildir.
If mailbox, one would MOVE a mailbox to a new location (you DO NOT want to
be appending to a mailbox you're reading from), then:
formail -s procmail -m .procmailrc < some_mailbox
Which would split it into it's individual component messages and pass it
into procmail to be reprocessed. If you have multiple mailboxes to
refilter (any of which might already be destinations for procmail filters),
it'd be a good idea to MOVE them ALL before running refiltering the lot.
[snip]
> :0:
> * .*anyone.com
> | $FORMAIL -A"X-Sorted: Bulk >> $MAILDIR/anyone
You seem to be using formail where formail is not really needed.
Instead of | into formail, you can just specify the folder location.
Plus, you also need better regex for comparison. ie:
:0
* ^Subject:.*junk
$MAILDIR/anyone
Uh, you must have missed that bit about adding a custom header:
-A"X-Sorted: Bulk"
(which as shown in Mohsenruddin's recipes, is missing the closing
doublequote, which obviously needs fixing).
The redirect into /dev/null though shouldn't be piped through anything
though - it should just be deposited in /dev/null.
$MAILDIR/ should not need to preceed any of the folders though (yea, I'm
often guilty of this myself, and it certainly doesn't _break_ anything) --
$MAILDIR is the default dir for files to be written to already
(effectively, it is the cwd).
I'm leery of the fact that Mohsenruddin isn't specifying a header to match
against - the ".*anyone.com" stuff will match against anywhere in the
headers - of course, this may be the object, but I doubt that it is
(Received: lines for instance would match). Of course, since it isn't
anchored to the beginning of the line (^), or after something else in
particular, the leading .* portion of the regexp isn't necessary. Dots
which should be actual dots should be escaped.
Thus, rewritten, Mohsenruddin's recipe's should appear like:
## SPAM - no lock necessary when writing to /dev/null
:0
* whoever.net
/dev/null
## SORT mails
:0:
* list1\.com
| $FORMAIL -A"X-Sorted: Bulk" >> list1
:0:
* list2\.com
| $FORMAIL -A"X-Sorted: Bulk" >> list2
:0:
* anyone\.com
| $FORMAIL -A"X-Sorted: Bulk" >> anyone
Though I'd still look to specify specific headers for the match criteria,
such as Robert has also suggested.
---
Sean B. Straw / Professional Software Engineering
Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
Please DO NOT carbon me on list replies. I'll get my copy from the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail