procmail
[Top] [All Lists]

Re: Self-Modifying .procmailrc

1997-10-07 09:26:12
On 07 Oct 1997 18:12:12 +0300, Jari Aalto 
<jari(_dot_)aalto(_at_)ntc(_dot_)nokia(_dot_)com>
wrote:
| Mon 97-10-06 Timothy J Luoma <luomat(_at_)peak(_dot_)org> list.procmail
| # look for the file to tell us whether or not to forward mail or not
| # if the file exists, forward the mail
| :0c
| * ? test -r $HOME/.forwardmail
| ! me(_at_)elsewhere(_dot_)com
send mail from the current account and get mail forwarded somewhere
according to the Reply-To address:
        From: me(_at_)remote(_dot_)com
        Subject: forward-on SOME-MAGIG-PASSWORD-STRING
        Reply-To: ThisAccount(_at_)here(_dot_)com
The procmail would see if SOME-MAGIG-PASSWORD-STRING matches
and set the current forwarding to ThisAccount(_at_)here(_dot_)com(_dot_)

You should probably restrict this to only look at mail from your own
account(s), and perhaps do away with the password stuff. (I don't
think it adds that much security. But then it's not much extra work
either.)

    :0 # Off top of head
    * ^From:(_dot_)*jari\(_dot_)aalto(_at_)ntc\(_dot_)nokia\(_dot_)com
    * ^Subject: forward-on PASSWORD$
    * ^Reply-To:
    {
        :0c
        | formail -zxReply-To: >.forward-address

        # This will actually send a copy of the forward-on message
        #  to the new forwardee, isn't that sufficient for notification?
        # (Certainly better than losing the whole message IMHO.)
    }

    # ... handle rejections here

    :0
    * ? test -s .forward-address
    ! `cat .forward-address`

Notice how the subject line is anchored with a $ at the end; I do that
with my passwords. Or you could allow only whitespace before EOL.

It would be great if the procmail responded to "me(_at_)remote(_dot_)com" 
that
"Forward now pointing to ThisAccount(_at_)here(_dot_)com" or "You have no
permission to change Forwarding" if the SOME-MAGIG-PASSWORD-STRING is
invalid.

formail -rt will obey Reply-To but you could of course remove it
before generating the reply:

    :0ch
    | ( formail -IReply-To: | formail -rt -I"Subject: $SUBJECT"; \
        cat $RESPFILE ) | $SENDMAIL -oi -t

I have assumed that whatever you did above this set the SUBJECT and
RESPFILE to reflect what happened -- either allow or deny forward
redirection. The left, as they say, is left as an exercise.

/* era */

("magic" has only one g.)

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

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