procmail
[Top] [All Lists]

Conditional subject

1997-09-03 06:37:54
I have a lot of repetition in my recipes that I'd like to factor into an
INCLUDERC.  One tricky part is to supply a specific subject sometimes, and
let formail generate an "Re: xxxx" other times.  Here is what I've tried:


  SUBJECT     = "Mail Delivery Refused: Too Large"
  COPY_FOLDER = $SPAMFOLDER
  COMMENT     = "Huge"
  RESPONSE    = "too_large.msg"

  :0:
  * >10000
  * !^X-Loop: noloops_for_wwgrol(_at_)fw(_dot_)hac(_dot_)com
  { INCLUDERC=autorespond.rc }


where autorespond.rc contains (thanks to this list):

  :0c:
  $COPY_FOLDER

  :0fhw  # double the head; second head is now part of body
  | sed -e H -e '$ G'

  :0fhw  # invert first head and slip in message after it (before second head)
  | formail -Y -ri"Subject: $SUBJECT"                  \
            -tA"X-Loop: noloops_for_wwgrol(_at_)fw(_dot_)hac(_dot_)com" \
            -A"X-Comment: $COMMENT" ;                  \
    cat $RESPONSE

  :0     # send it all out
  ! -t


Would it work if I were to sometimes put 

  SUBJECT = "-i\"Subject: yadda yadda\""

and other times

  SUBJECT = ""

and change the line above to

  | formail -Y -r $SUBJECT                  \

??

Anything else wrong with this approach?

<Prev in Thread] Current Thread [Next in Thread>