procmail
[Top] [All Lists]

Re: How do I extract the "Subject"

1996-07-26 16:52:16
When Rajiv Baronia asked:

B> Basically, I would like to extract the "Subject" field from a message
B> and pass it to a shell program in the form of a variable.

Guy Geens suggested:

G> This should do the trick:

G> SUBJECT=`formail -zxSubject:`   # these are backquotes

G> :0 <flags>
G> * conditions
G> | program $SUBJECT

If your version of procmail is new enough to support extraction (and it
probably is if your version of formail is new enough to have the -z option),
this is better because it saves a process:

 :0 <flags>
 * conditions, including this one:
 * ^Subject:.*\/[^      ].*
 | program "$MATCH"

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