procmail
[Top] [All Lists]

Re: Just invoking a program

2001-04-25 20:30:26
Paul Foster asked,

| Recipe:
| 
| :0
| * ^Subject: something <\/.*>
| {
|       :0 c
|       bounce
| 
|       :0 w
|       | here's the part I don't know
| }

| Okay, now normally if you put that pipe symbol before the action line,
| it pipes the email in question to whatever command you've specified. In
| this case, I don't want it to do that. I simply want a program to start
| and be passed the contents of the $MATCH variable. In other words, I
| want to throw away the whole content of the message, headers and all,
| and start over, with only the contents of $MATCH to go on.

General answer first: if the command requires the value of $MATCH on the
command line,

 :0wi
 | command "$MATCH"

or if it requires the contents of $MATCH as standard input,

 :0wi
 | echo "$MATCH" | command

The `i' flag is needed to tell procmail not to treat the situation as a write
error when the command (in the first form, or echo in the second) doesn't
finish [in this case, doesn't even start] reading in the message text that
procmail tries to feed it.

Specific comments:

 :0
 * ^Subject: something <\/.*>
 # you probably don't want the closing angle bracket in the value of MATCH
 * MATCH ?? ^^\/[^>]+
 {
 # unless "bounce" is a directory, the save to it needs a local lockfile
        :0 c:
        bounce
 
        :0iw
        | command "$MATCH" # or echo "$MATCH" | command
 }

Since you're using a `w' flag, be prepared to deal with procmail's exiting
the braces and continuing to read recipes if the command returns a non-zero
exit status.

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