procmail
[Top] [All Lists]

Re: help with extraction recipe

2007-10-12 08:20:01
At 09:43 2007-10-12 -0500, Terry wrote:
Here is what I have:

The actual subject is:
f00 ack RE: ** PROBLEM alert - OMAJELUT01/telnet is CRITICAL **

LOGFILE=$HOME/.procmailrc.log
VERBOSE=no
PATH=/usr/bin
:0
SUBJECT=`formail -xSubject:`
| /usr/lib/processmail "$SUBJECT"

That's not a valid recipe syntax.

The first thing after a flags line should be either:

         A condition, which starts with *

         an action - the name of a file to deliver to, or a pipe to a
         program to invoke.

         an open brace


The log shows:

procmail: Skipped "ack RE: ** PROBLEM alert - OMAJELUT01/telnet is 
CRITICAL **"
[snip]

Dunno about your stack trace stuff - looks like you have a bad compile or 
library version incompatability perhaps.


Since a large procmail recipe collection will refer frequently to certain 
elements, my standard routine is to extract and manupulate several header 
fields right up front, so the content of them is available to all recipes 
that follow.  Some of those are in the "sandbox" published at my 
website.  The one which is applicable to you is:

         :0
         * ^Subject:[    ]*\/[^  ].*
         {
                 SUBJECT=$MATCH
         }

(brackets enclose a space+tab)

This obtains the subject with MUCH less overhead than invoking formail to 
grab it.

Then, your recipe follows the one above:

         :0
         | /usr/lib/processmail "${SUBJECT}"


This is probably the better way to accomplish this, since is there is NO 
subject, you should still be invoking your processmail program, whereas you 
could combine them:

         :0
         * ^Subject:[    ]*\/[^  ].*
         | /usr/lib/processmail "${MATCH}"

However, this form would ONLY invoke processmail when there's something to 
match in the Subject header.  Most notably, the absence of a Subject: 
header entirely would cause this recipe not to invoke the processmail program.

---
  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 homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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