> From: "Enrico Payne" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: Procmailrc rule question
>
> Hello, I have the following procmail recipe setup, that seems to be working
> with most e-mails. However, one with the subject ""Free! Porn TV! Check it
> out!" managed to slip through. I can only guess that this is because the "!"
> after Free was causing the recipe to complete? If this is the case, how do
> write the recipe so that it will ignore all "!"? If this was not the case,
> what am I doing wrong?
>
> RECIPE
> ---------------------
>
> # Trap e-mails with various subjects
> :0
> * !^FROM_DAEMON
> * $!^${XLOOP}
> * ^Subject: (new photos from my
> party\!|.*[Xx][Xx][Xx].*|.*[Nn][Uu][Dd][Ee].*|.*
> [Pp][Oo][Rr][Nn].*|A comical story for you|.*[Ss][Ee][Xx].*|Best Adult
> Web|.*[Ee
> ][Rr][Oo][Tt][Ii][Cc].*|.*[Hh][Aa][Rr][Dd][Cc][Oo][Rr][Ee].*|.*[Tt][Oo][Oo][
> Nn].
> *|See what .* sent you\!\!)
> {
> :0
> ! [EMAIL PROTECTED]
> }
> ----------------------
> Enrico Payne
>
I assume that in fact you had the whole regexp on one line, though it
doesn't appear that way, at least in the digest form of the message.
It looks like your expression should have worked, but I do have some
observations:
You don't need the backslashes in front of the exclamation points in the
pattern
You don't need things like "[Pp]" unless you're using the "D" flag to
make the regexp matches case-sensitive; they're case insensitive by
default. ".*porn" and ".*[Pp][Oo][Rr][Nn]" will match the same strings.
Getting rid of these constructs makes tha pattern much easier to read.
".*" at the end of a regexp pattern doesn't accomplish anything
Note that you can check out these regexps by using "egrep -i" on them,
since procmail uses the same regexp patterns as egrep.
After the simplifications mentioned above, your regexp becomes (all one
line)
-------------
^Subject: (new photos from my party!|.*xxx|.*nude|.*porn|a comical story for
you|.*sex|Best Adult Web|.*erotic|.*hardcore|.*toon|See what .* sent you!!)
-------------
I verified that this expression does indeed match the subject you
mentioned:
----------
[petep@ns2 /tmp]$ echo 'Subject: Free! Porn TV! Check it out!' | egrep -i '^Subject:
(new photos from my party!|.*xxx|.*nude|.*porn|a comical story for you|.*sex|Best
Adult Web|.*erotic|.*hardcore|.*toon|See what .* sent you!!)'
Subject: Free! Porn TV! Check it out!
----------
As you can see, the "Subject: Free! Porn TV! Check it out!" matched the
regexp and got printed out.
It's possible that the expression didn't match because there were some
funny characters outside the normal ASCII range that were either invisible
or printed as normal characters. If you pipe the problems message and
headers through "cat -v -t -e", do you see any funny characters?
Another thing you which you probably realize already is that your filter
will trigger on things like "sextant", "sextuplets", "pontoon" and
"Saskatoon".
pete
--
pete peterson
Teradyne, Inc.
7 Technology Park Drive
Westford, MA 01886-0033
[EMAIL PROTECTED] or [EMAIL PROTECTED]
+1-978-589-7478 (Office); +1-978-589-2088 (Closest FAX);
+1-978-589-7007 (Main Teradyne Westford FAX)
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list