procmail
[Top] [All Lists]

Re: Tag recipe

2002-06-17 12:19:57
Ashley has,

| MATCH
|
| :0 fhw
| * ! TAG ?? ^^^^
| *  ^Subject: *\/[^ ].*
| | $FORMAIL -I "Subject: $TAG ${MATCH:-<no subject>}"

[Since it takes at least one character to satisfy the right side of the
extractor, if the action is executed, MATCH cannot possibly be null or unset,
so "<no subject>" will never be substituted.]

and asked,

|     a) how can I make it so that it's case INsensitive?

It is case-insensitive by default.  Procmail uses case-sensitivity in matching
to regexps only when you put the `D' flag onto the recipe.

|     b) Occasionally someone will send a message without a subject, and
|        I would like those messages to still be tagged, however that's
|        not happening.  What'd I miss?

You have a condition on it that requires the existence of a non-empty subject
header.  Here's one of many possible ways to handle the situation:

 :0 # if TAG is non-empty and not already in the subject
 * TAG ?? .
 * $ ! ^Subject:.*$\TAG
 {
  :0hfw # subject has at least one non-blank character
  * ^Subject: *\/[^ ].*
  | formail -I "Subject: $TAG $MATCH"

  :0Efhw # subject is present but empty or all blank
  * ^Subject:
  | formail -I "Subject: $TAG <empty subject>"

  :0Efhw # otherwise, subject header must be missing
  | formail -I "Subject: $TAG <no subject header>"
 }



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