procmail
[Top] [All Lists]

Re: Subject: [tag]

1999-03-07 19:37:33
How do I insert a [list] tag into the Subject: field ?

Most mailing list software will deal with this stuff for you,
so this may or may not be relevant.  But if you're doing it for
your own archiving needs or whatever, this recipe should work
for you:

   :0 fhw
   * ^Subject:[  ]\/.*
   | formail -I "Subject: [list] $MATCH"

The brackets after Subject: contain both a space and a tab...

And for a quick breakdown...

   :0 fhw means consider the pipe on the action line of
   this recipe to be a filter, only feed the header to 
   this filter, and wait for the filter to exit with a
   non-error.

   \/ takes anything to the right of itself and puts it into
   $MATCH.  So the Subject: regex takes anything after Subject:
   plus a space or tab and puts it into that variable.

   formail -I removes a header with that name if it exists,
   then replaces it with the new one.  So you're saying
   "remove the old Subject: header and replace it with
   this one"...

Chris

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