procmail
[Top] [All Lists]

Evaluating environment variable in recipe

1998-06-10 16:29:46

First of all, I haven't received any mail from the list in several
days (I'm on the digest) -- is the list down?  For certainty's sake
it would help to cc any replies directly to me.

I've been trying to set up a safety mechanism so that messages with
too many junk mail characteristics are bounced with an explanation,
giving legitimate correspondents a chance to resend the message
with a particular resending keyword in the Subject line.

It works as intended.  However, I would like to be able to make the
resending keyword an environment variable (so that I can change it
conveniently), and I haven't been able to get the procmail recipe
to evaluate the variable.

The relevant sections of my .procmailrc are below.  The resend
keyword is currently RALPH;  I want it to be taken from the environment
variable RESEND_KEY.  Note that I tried setting RESEND_KEY with and
without quotation marks, neither successful.  The evaluation
of RESEND_KEY_RECIPE later in the file works okay though.

I'd appreciate any corrections or suggestions.

---------------------------------------------------
         START OF .PROCMAILRC EXCERPT
---------------------------------------------------
#RESEND_KEY="RALPH"  #code word for getting mail through filter
RESEND_KEY=RALPH  #code word for getting mail through filter
RESEND_KEY_RECIPE="ralph (in UPPER CASE)"  #formula for RESEND_KEY
[skip]
#
        :0HDw:resend_key
# --- doesn't seem to recognize env variable as key; need to investigate ---
#        * $RESEND_KEY
        * RALPH
        $HOME/resent-mail/.
[skip]
#
# Test for typical junk mail words.  Handle based on score.
#
        :0Bw
        * (sex|adult|million|remove|cash|free|money)
        {
          :0Biw
          *  -99^0
          *   50^1 sex
          *   50^1 adult
          *   50^1 million
          *   50^1 cash
          *   50^1 remove
          *   40^1 free
          *   40^1 money
          * !^FROM_DAEMON
          * !^X-Loop: deeds(_at_)pobox\(_dot_)com
          {
            :0:reject
            |($FORMAIL -rk -p\> -A"Precedence:junk" \
                -A"X-Loop: deeds(_at_)pobox(_dot_)com" \
                -A"X-Loop2: Rejected by filter"; \
                echo "An automated mail filter has identified this message";\
                  echo "as probable junk email.  To reach the intended";\
                  echo "recipient, please send it again with the word";\
                  echo "$RESEND_KEY_RECIPE in the Subject line.")\
                |$SENDMAIL -oi -t
#
# In case the reply is not sent for any reason (sendmail error),
#    trash the incoming junk message so it doesn't fall through to 
#    the mailbox.
#
            :0e
            /dev/null
          }
#
# If a message has some of the junk mail words but not enough to pass the
#    recipe above, save a copy in $HOME/probably-junk-mail.
#
          :0E
          $HOME/probably-junk-mail/.
#
        }
---------------------------------------------------
         END OF .PROCMAILRC EXCERPT
---------------------------------------------------


By the way, I've changed my address in the above to pobox, as that's how
I'm subscribed to this list.  I'm actually running procmail at netcom.


-- Dean Deeds

<Prev in Thread] Current Thread [Next in Thread>
  • Evaluating environment variable in recipe, Dean/Margaret Deeds <=