procmail
[Top] [All Lists]

Re: Need help to filter bounces...

2001-11-13 12:29:35
At 13:21 2001-11-13 -0500, Errol Casey wrote:
Here is my first attempt which doesn't seem to be working.

:0
* ^From: MAILER-DAEMON(_at_)amr(_dot_)boo-bear(_dot_)com
* ^Subject: failure notice
{
 :0
 * ^Subject: Please confirm your message
 | $FORMAIL -I "Subject:[TMDA Bounce] " >> ${MAILDIR}/bounces
}

FIRST, you should really consider just temporarily setting VERBOSE=ON, pipe one of these messages into sendmail, and check the log results. You'd become enlightened in no time. I make this suggestion nearly every time someone posts about a rule which doesn't seem to work the way they thought it would, BECAUSE it's such an effective diagnostic tool. See the URL in my .sig

SECOND, your outer conditions specify a subject of "failure notice", which will match the message. If you had VERBOSE=ON, you'd see that the outermost two conditions match. However, your INNER condition specifies a DIFFERENT subject, which should be found in the BODY of the message, not in the HEADERS. This time, VERBOSE logging would have said "no match".

Try changing that inner subject condition to:

        * B ^Subject: Please confirm your message

In fact, you could just toss it all into one level. If you were checking multiple things based on MAILER-DAEMON and failure notice, the braced system would make sense, but if not, this is more direct:

#--- cut here
VERBOSE=ON

# with lockfile - you ARE delivering to a file.  If you deliver to this
# same file elsewhere, you need to give this same explicit lockfile.
:0:bounces$LOCKEXT
* ^From:[       ]*MAILER-DAEMON(_at_)amr(_dot_)boo-bear(_dot_)com
* ^Subject:[    ]*failure notice
* B ^Subject:[  ]*Please confirm your message
| $FORMAIL -I "Subject:[TMDA Bounce] " >> ${MAILDIR}/bounces

VERBOSE=OFF
#--- cut here

I changed leading spaces to bracketed [space+tab], to be more forgiving

Q: why the trailing space on the rewritten subject?

Here is full sample bounce message that I want to filter:

[snip]

Please try your best not to provide the full text of a SPAM on any future messages to this list or it's members. Eventually (if not already), you're rather likely to trigger someone's vicious SPAM defences. Besides, it's annoying to get SPAM via legit posts on this list.

---
 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

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