procmail
[Top] [All Lists]

How to set a VARIABLE value with a filter

2010-03-04 19:51:44
I think I've done this before but can't find it in old .procmailrcs.

If I wanted to filter certain line in the body and re-write them back 
to the message, but in the header... 

1) extract something from body into a variable seen by procmail
2) Remove all subject headers
3) Insert new subject header with the VAR from 1 folded under it.

example of desired result:

  `Subject: my incoming subject
       -folded material that was extracted from body
       -more of the same'     

I'm thinking something like the code below.  No doubt poorly written
but hopefully the intent will be apparent.

  :0
  * ^Subject:\/.*$
   {
     { 
      :0 cb
        ## Here I want the output of somescript to become the value
        ##  of a variable procmail is aware of.   
        | somescript
        
#        ## These concoctions below do not get the desired result
#        myvar=|somescript
#        |myvar=$(somescript)          
        
        /dev/null
     } 
    :0 fw
      | formail -I "Subject"

    :0  
      | formail -a "Subject: $MATCH\n$myvar"
 
     elog.in
   }

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