At 10:38 2004-04-14 -0400, Gabe Law wrote:
machine 1: (Solaris 9)
This machine receives all my email. I want to save email with subject
marked as GABEFILTERED in one directory, email marked as BMISPAM in
another directory, and the rest forwarded to my filtering machine. Note I
do not have root access to this machine.
LOGFILE=$HOME/procmaillog
After this, add:
VERBOSE=ON
Which would give you more insight into what is happening.
SUBJ_=`formail -xSubject: \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
May as well comment that out if you're not using it - it's an immense waste
of processor since you NEVER make reference to the variable on this
config. See below for a cleanup of this (since that copy actually had
comments and is USED).
:0
* ^Subject: BMISPAM.*
mail/spambmi
You MENTION directories above in your commentary, but there's no assurance
to anyone looking at this recipe that mail/spambmi is actually a directory
- if it is, you might add a comment right at the recipe. If it ISN'T
(which is generally what someone would expect looking at this), then it's
worth noting that you don't have a file locking flag there (or on the
recipe afterwards).
Note that there is NO purpose whatsoever to using .* at the END of an
expression, unless you're using a MATCH operator (which you are not). Do
you know that the subjects are prefixed with a SINGLE space, or might there
be multiple, or a tab?
machine 2: (Redhat 8)
This machine has Brightmail Anti-Spam running on it.
That may be, but the previous system, which seems to be your initial
recipient, has no mention of what should be running that would be adding
the comments. Or is THIS machine actually the first recipient of mail, and
"machine 1" the final delivery point?
It tags the
subject for all spam as BMISPAM. I want to tag all non spam as
GABEFILTERED, and forward all mail back to machine 1.
LOGFILE=$HOME/procmaillog
#Get the subject discarding any leading and trailing blanks
#Note: On some systems -xSubject: has to be -x"Subject: "
SUBJ_=`formail -xSubject: \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
Manpages are a wonderful thing -- try this, which is much simpler, and
requires no pipelining:
SUBJ_=`formail -zxSubject:`
This doesn't tinker with tab conversions in t he MIDDLE of the string, but
leading and trailing will have been dealt with. Do you have a BROKEN MUA
that necessitates the tab conversion?
[snip]
Try this cleaned up version:
LOGFILE=$HOME/procmaillog
VERBOSE=ON
# Get the subject discarding any leading and trailing blanks
# if you REALLY need to replace tabs with spaces, you can still pipe to expand
SUBJ_=`formail -zxSubject:`
:0
* ! SUBJ_ ?? ^BMISPAM
{
# This would not be set if this filter doesn't trigger.
GABEOTRONIC="GABEFILTERED "
}
# rewrite the Subject header anyway (since we may have stripped spaces)
:0 fwh
| formail -i"Subject: ${GABEOTRONIC}${SUBJ_}"
:0
!glaw(_at_)eecs(_dot_)tufts(_dot_)edu
---
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