Alexandre Farcy <Alexandre(_dot_)Farcy(_at_)prism(_dot_)uvsq(_dot_)fr> writes:
in my .procmailrc how can i change the "From" field of a message (before
i store or forward it) with formail ?
i want to add a word to the Sender name according to the subject of the
mail...
Okay, let's say you have the word you want to add to the From: field
in the WORD variable. I assume you'll add it inside parens so that
the From: field will still be syntactically correct and have the same
meaning. (This recipe requires procmail version 3.10 or later, as it
uses the MATCH variable.)
# 'f'ilter the 'h'eader through formail, 'w'aiting for it finish
# to check the return code
:0 fhw
* ^From:\/.*
|formail -I"From: $MATCH ($WORD)"
If you wanted the word to be at the beginning of the From: field, you
would change the action line to:
|formail -I"From: ($WORD) $MATCH"
Yes, there will usually be two spaces next to each other in the
resulting From: line, as the value of MATCH will almost certainly start
with a space.
Philip Guenther