Alexander Hutapea wrote:
:0fhw # 1. Add X-Loop and Reply-To
| formail -A "X-Loop: permias(_at_)colorado(_dot_)edu" \
-A "Reply-To: permias(_at_)colorado(_dot_)edu" \
-I "Subject: [permias] $SUBJECT"
2. I need prefix [permias] in the subject, but if someone reply the
mail, i don't need the prefix again, because it has already has it
Either split the formail call up in two, one done unconditionally to
add X-Loop and Reply-To, the other to change the subject called only
if the prefix isn't present yet:
:0 fhw
| formail -A "X-Loop: permias(_at_)colorado(_dot_)edu" \
-A "Reply-To: permias(_at_)colorado(_dot_)edu"
:0 fhw
* ! ^Subject:.*\[permias]
| formail -I "Subject: [permias] $SUBJECT"
- or, more efficient, check for the prefix, and if it's not there yet,
add it to your SUBJECT variable before doing a single formail call:
:0
* ! ^Subject:.*\[permias]
{
SUBJECT="[permias] $SUBJECT"
}
:0 fhw
| formail -A "X-Loop: permias(_at_)colorado(_dot_)edu" \
-A "Reply-To: permias(_at_)colorado(_dot_)edu" \
-I "Subject: $SUBJECT"
By the way:
:0
* ^(To|Cc|cc):.*permias
Without the "D" flag, procmail's matching is case-insensitive anyway,
so you don't need to check for "Cc" and "cc" separately, one of them
is enough. But you might prefer
* ^TO_permias
or (if your procmail version doesn't have ^TO_ yet)
* ^TOpermias
anyway; have a look at man procmailrc for details.
/HW