procmail
[Top] [All Lists]

keeping To: and From_ when forwarding?

1999-01-09 23:56:28
Howdy all,

I think I've stated my question farily well in the comments below. Basicly
the idea of the following recipe is to test to see if 'authorize' is
anywhere in the Subject: and if it is, then do 3 things:

1) send the sender a message stating that in the future they need to 
   send their 'authorize' request to a different address (erosters in 
   this case)

2) forward their 'authorize' request to erosters, keeping both the
   Subject: and body 100% intact, and making sure that the From_ header
   shows their address and the To: header is addressed to erosters 
   (this .procmailrc is for an account named egrades, which runs
   a similar, but different program).

3) finally, log the transactions in a special log file.

I'm only having problems with step #2. My tests with formail didn't
produce the needed results, but I am sure I'm just using the correct args
for the 2nd recipe [if it was formail-based]. Using v3.10 1994/10/31

Any tips appreciated!

/Vince/


UMASH=037
MAILDIR=$HOME/MailBox
LOGFILE=$MAILDIR/MailLog
DEFAULT=$MAILDIR/inbox/.
X_LOOP=${X_LOOP:-"UCIORAIS"}
AUTHORIZEBOX=$MAILDIR/authbox/.
SENDMAIL=/usr/lib/sendmail

# the below recipe is in both 'egrades' and 'erosters' .procmailrc

:0 fhw
| formail -I "From " -a "From "

# first nested recipe forwards message to user giving him/her a clue
# where to send future authorize requests - to erosters, not egrades!

:0
* ^Subject:.*authorize
{
   LOGFILE=$MAILDIR/authlog
   :0 hc
   * !^FROM_DAEMON
   * !^X-Loop: $X_LOOP
   | (formail -r -A"X-Loop: $X_LOOP" ; \
   cat $HOME/authorize.txt) | $SENDMAIL -oi -t

   # the following recipe needs to be modified so that 
   # the To: shows 'erosters' not 'egrades' but the
   # body of the original message must be kept 100% intact!
   # the From_ header stays the same [this does work, as
   # the original sender's From_ is kept 100% intact]

   :0c
   ! erosters

   # we're logging these requests in a different mailbox
   # to keep track of who is sending requests to the 
   # wrong address

   :0w:write.lock
   $AUTHORIZEBOX
}

# let's make sure we're back to using the default log

LOGFILE=$MAILDIR/MailLog

# and now let's process egrades only requests via python

:0c
| (cd $HOME/MailBox; python-1.3 egrades_main.py )


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