procmail
[Top] [All Lists]

Re: Need a formula for forwarding and rejecting email from lists

2006-07-08 20:05:35
Well, maybe someone else can help him, then.  I've already
deleted the message and won't have time to go back and find it
again in the archives.

Shouldn't need to - I reposted them in the reply to Ruud's post.

The reply to Ruud's post *is* the message he's already deleted.

The ISP's code that you quoted, if you quoted it accurately, *is*
wrong; it works only by accident.  So apparently you're getting your
whole $10 per month worth, maybe less; if it were me, I'd expect them
to really break something eventually.

However ...

Assuming that the egrep+sed that assign to GOOD and BAD are correct,
you have four problems.  The first is that you don't need the { braces
} in the places where you've put them, so get rid of them.  An
open-brace is only meaningful to procmail if it appears as the first
non-whitespace character of the action line of a recipe.

The second and third are both in this line (and also in the BAD
condition later):

* GOOD ?? ^[a-zA-Z].*$        # trying to test if GOOD has some characters

Second: You can't put a comment on a condition line.  Everything after
the "*" is part of the condition, including the whitespace (unless the
line ends with whitespace followed by a backslash, which is a special
case).

Third: Even if you remove the comment, what you're testing is that
GOOD begins with an alphabetic character.  That's not the same as
testing whether it has "some" characters.  Procmail regular
expressions are a subset of perl's (except for the \/ and ^^
operators) and as you claim to know perl, you ought to be able to
figure this one out yourself.  The trailing .*$ can be dropped, you
don't care what the string ends with.

The fourth problem is that a recipe may have exactly one action line.
In the BAD recipe, you are trying to both assign to EXITCODE and also
forward the message, which is *two* actions.  Further, a plain
assignment is not a valid action, so you can't set EXITCODE where you
are attempting to do so.  You need

# Maybe fix the regular expression below
 :0
 * BAD ?? ^[a-zA-Z].*$
 {
    # Brace as the action line begins a block, so now the assignment is OK
    EXITCODE=76
    # Now we need to begin a new recipe to get a new action line.
    # This recipe has no condition lines, the outer recipe took care of that.
    :0
    ! $BAD
    # That's done, so now we can close the block
}

And that's way more help than your attitude deserves.

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail