procmail
[Top] [All Lists]

Re: conditional (on output of another program) forwarding

2000-09-14 23:06:43
From: "David W. Tamkin" <dattier(_at_)ripco(_dot_)com>

So if any mail came in between the time you got dropped and the time
you logged back in, the $HOME/.${LOGNAME}isinthehouse file would still
exist and procmail would think you were on line; however, it seems
to me that finger and who would also believe you were on line, so
procmail can't take their word for it either.

All right, folks, how does one tell the difference between a login
shell that should have exited but didn't and one that is still in
interactive use?

The heuristic may not be robust enough for this system to be
viable.  I'd tend to want to fall back to your earlier (two-years-
ago-earlier :-) schema to forward all mail on demand from another
address, even without fetchmail.  Remember this?


######
###### Next recipe looks for mail from me with a specific header.  Then,
###### if I provide the correct password in the body of the mail, my
###### mail spool on this server is wrapped up and mailed to me at
###### another address; and my local spool is cleared.
######

 :0D
 * ^From .*d(man|ross)
 * ^Subject: +#FWMAIL
 {
  MAILDIR=$HOME/.mailbox # this is how to make procmail cd

  INCLUDERC=.forwardpass

  :0 B:  # B means search body, not headers
  * $ ! ^$SPOOL_FORWARD_PASSWORD$
  spoofattempts

  LOCKFILE=$ORGMAIL$LOCKEXT # regional lockfile; we'll be using it until
     # procmail exits, so we don't need to unset LOCKFILE to remove it

  :0c: # if you want to keep copies of the trigger messages
  forwarding_requests

  VERBOSE=on  # extended logging

  :0friw
  * ? test -s $ORGMAIL # if $ORGMAIL is non-empty
  | cat $ORGMAIL

  VERBOSE=off

   :0Arc
   | formail -I "X-Forwarded: from $LOGNAME(_at_)$HOST" \
              -A "X-Loop: Dallman's Amanuensis"     \
              -es $SENDMAIL $SENDMAILFLAGS dman(_at_)my-other-address(_dot_)com
   :0Arc  # for safety during testing; once it's working, drop this step
   | gzip -fc >> .sentspool.gz  # compress and append to backup
   :0Ahi
   | true > $ORGMAIL # safer to empty it than to rm it

  :0bfwi
  | echo "$ORGMAIL was empty.  There was nothing to forward."
   :0hfw          # not to get return address but to add Re: and remove
   | formail -r  # old From: and Date: and remove X-Forwarding-Password:
   :0
   ! dman(_at_)my-other-address(_dot_)com

  MAILDIR=$HOME/Mail/archive  # change directories
 }

-- 
Note: my 8.5-year-old netcom.com address will soon disappear
when Netcom closes its doors.  Please update your records to
reflect my new address as: Dallman Ross <dman(_at_)NotNetcom(_dot_)com>

Ex-Netcom users: get free email forwarding at NotNetcom.com!
NOT affiliated with EarthLink, Inc.'s Netcom brand-identity.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail