procmail
[Top] [All Lists]

getting Subject: text into $MATCH

2000-04-25 20:06:20
  :0
  * ^Subject: \/.*
  { }

What's the curly bracket stuff for here?  It confused me
to see { } like that.  Why not just open-brace, and close
when you're done?

You must put \/ into a condition line, a condition line must be inside
a recipe, a recipe requires an action. { } Is a null action. The purpose
is to set MATCH to the subject text. For the case of a missing subject,
this recipe must be preceded by a MATCH="" line. Afterwards $MATCH
contains the subject text (minus leading white space) or is empty.

Alternatively, use scoring. This may save a line or 2 as it can often
be combined into other recipes.

  :0 hfw        # subject in MATCH (init to "" in case there is no Subject:)
  * 1^0 .*$\/
  * 1^0 ^Subject:[      ]*\/..*
  | formail -rI"Precedence: junk" \

Both condition lines will always be executed. The recipe will also always
be executed as the first condition is always true (and contributes a
positive score). See log file for actual numbers (VERBOSE=on).

The first period on the second condition is to make sure at least 1
character gets put into $MATCH, otherwise $MATCH might not get properly
set (or so the FAQ says) http://www.iki.fi/era/procmail/mini-faq.html
What if there is no non-white subject? Condition 2 fails. $MATCH remains
empty from condition 1 - just what we want anyway.

Volker

<Prev in Thread] Current Thread [Next in Thread>
  • getting Subject: text into $MATCH, Volker Kuhlmann <=