procmail
[Top] [All Lists]

Re: how to add score to header

2001-06-07 19:12:27
Lukasz asked,

K> How to add score variable to message header ?
K> i.e.
K> X-Score: -250

Martin responded,

M> Err...by using a recipe such as the one John Conover just posted at the
M> start of this thread of messages when he gave his example:

C> :0
C> * 1.23^0 something
C> * 4.56^0 somethingelse
C> {
C>     SCORE=$=
C>     #
C>     :0 wfh
C>     | formail -A "X-SCORE: $SCORE"
C> }

If that's what John posted, either he erred or he was handling the specific
case where the score was greater than zero and getting lavish with braces in
the process.

For Lukasz, who wants to handle negative scores:

 :0
 * 1.23^0 something
 * 4.56^0 somethingelse
 { SCORE = $= }
 :0wfh
 | formail -A "X-Score: $SCORE"

or, since there are no characters from $SHELLMETAS in the command, this
should do the job as well:

 :0
 * 1.23^0 something
 * 4.56^0 somethingelse
 { }
 :0wfh
 | formail -A "X-Score: $="

If you want to add the line only when the score is positive as John's code
does,

 :0wfh
 * 1.23^0 something
 * 4.56^0 somethingelse
 | formail -A "X-Score: $="

and no braces are necessary.

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