procmail
[Top] [All Lists]

error question, brain-picking questions

1997-06-27 04:21:00
Hello out there,

I haven't had time to keep up here for a while.  But I will try
again now.  Due to rebuilding my Linux server I had to take
down the procmail setup I had going, and am sort of starting
over.  At least, I'm porting what I had to the new setup and
trying to iron out the bugs.  It's a time-consuming process,
to say the least.

1) For a while now I have been getting a lot of:

        procmail: Extraneous filter-flag ignored

Don't get what is causing that.  In any case, things are
not working according to plan.  Here is the full (non-verbose)
log entry, along with one that doesn't have the error:

From procmail-request(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE  Fri Jun 27 
05:51:29 1997
 Subject: IRC-WWW Gateway
  Folder: /var/spool/mail/dman                                             2057
procmail: Extraneous filter-flag ignored
From owner-liibulletin(_at_)listserv(_dot_)law(_dot_)cornell(_dot_)edu  Fri 
Jun 27 05:51:52 1997
 Subject: LIIBULLETIN, 26 June 1997 (4 cases)
  Folder: /var/spool/mail/dman                                            31376


Here is a recipe:

:0 w:  # don't forget the file-lock (second colon)!
* ^(TO|Reply-To:.*)\/(devwire|Ecomp-L|followers-l|infopro|\
        net-lawyers|Scout|Shareware-Dispatch|SIGnet)
$MATCH


Actually, I think I know why this isn't working.  The Linux Pro
package I used from WGS includes procmail v3.10 1994/10/31.
I probably need to upgrade that again now to be able to
use the $MATCH syntax the way I have it implemented.
the Linux installation did put procmail in place suid root, or is it
suid mail.  How do I check on that so I can duplicate it
in compiling the newer version?

2) Okay, my next question is:

I want to forward mail from other sites and once here at
the central receiving point I want to use a variation of my
existing procmail "vacation" auto-answer recipe
to answer them differently depending on where they
come from.  I want to look at the headers (using formail,
I guess) and decide which machine forwarded the mail
to the central address.  So if my .forward on netcom.com
sent a letter to the server I'm writing from (which is not
currently registered, by the way, and is accessible
only by IP number; but SMTP out to the world works
fine), I want to answer the person, "thank you for
writing to dman(_at_)netcom(_dot_)com"; but if it is the 
ix.urz.uni-heidelberg.de
server that forwarded, then it should be "thank you for
writing to o30(_at_)ix(_dot_)urz(_dot_)uni-heidelberg(_dot_)de"; etc., etc.

I know that I could have procmail/formail on each forwarding
host insert an X-header saying where it came from.  (I had
in mind to do this and to call it "X-Source: ".)  But I can't
install procmail on two of the hosts where I have accounts.
So I just want to forward it all and not worry about
multiple .procmailrcs, even on the machines where I
CAN use procmail.

Here is my vacation recipe:

## AUTO-REPLY ("VACATION") ACKNOWLEDGMENT:
##

        :0 W  # c is implicit and h unnecessary with brace nests
        * ! ^FROM_DAEMON
        * ! ^TOlist
        * ! ^From[      ]+[^ ]*(list|domo|support)
        * ! ^X-Loop: Dallman's Amanuensis
        {
             DELIVERED=yes      # tell sendmail to go away
             FROM=`formail -zrx To:| sed -e 's/@netcom[0-9]*/@netcom/'`
             SOURCE=`formail -zx X-Source:`
             # I just inserted the above line, but haven't implemented it

                      # NO-ACKS MODULE
             :0 wfhD  # case-sensitive, with "D"
             * ^Subject: *#SET NO-ACKS
             | lockfile -r0 $ACKS/NOACKS/"$FROM"

                      # UNSET-NO-ACKS MODULE
             :0 cwhD  # case-sensitive, with "D"
             * ^Subject: *#UNSET NO-ACKS
             | rm -f $ACKS/*/"$FROM"

                     # ADDRESS MODULE
             :0 whD # case-sensitive, with "D"
             * ^Subject: *#(GET|SEND) ADDRESS INFO
             | ( formail -r -I"From: 
                                           \
                 Dallman's Auto-Reply Daemon 
<dross(_at_)mwr1(_dot_)heidleberg(_dot_)army(_dot_)mil>" 
 \
                -I"Reply-To: Dallman Ross 
<dross(_at_)mwr1(_dot_)heidleberg(_dot_)army(_dot_)mil>" 
    \
                -A"Precedence: junk" 
                                           \
                -A"X-Loop: Dallman's Amanuensis"; cat $HOME/etc/.address ) 
     \
             | $SENDMAIL -oi -t

             SUBJ=`formail -zx 'Subject: '`
             ACKS=$HOME/.acks   # acknowledgments archive-directory

             :0 b  # asterisk is in $SHELLMETAS
             TESTNAME=|echo $ACKS/*/"$FROM"

             :0 ic  # if we are here, send off the ack
             * $ TESTNAME ?? ^^$ACKS/\*/
             * ? test -d $ACKS/$DATE || mkdir $ACKS/$DATE
             * ? lockfile -r0 $ACKS/$DATE/"$FROM"
             | ( formail -r -I"From: 
                                           \
                 Dallman's Auto-Reply Daemon 
<dross(_at_)mwr1(_dot_)heidleberg(_dot_)army(_dot_)mil>" 
 \
                -I"Reply-To: Dallman Ross 
<dross(_at_)mwr1(_dot_)heidleberg(_dot_)army(_dot_)mil>" 
    \
                -A"Precedence: junk" 
                                           \
                -A"X-Loop: Dallman's Amanuensis"; mcount -; 
                    \
                 echo "Some more information on our errant boy:"; echo ""; 
     \
                 rfin; echo ""; 
                                                \
                        sed "s/\$SUBJ/$SUBJ/" $HOME/etc/.acknowledgment ) 
      \
             | $SENDMAIL -oi -t

             :0 Difh  # keep UNSET NO-ACKS out of spool
             * ^Subject: *#UNSET NO-ACKS
             /dev/null
        }

A cron job or another recipe (depending on which host I use it on) erases
my logs and acknowledgments records after 7 days.  Anyway, I still need
to clean up a few things, such as the Reply-To: headers (they currently
recite the name of my unregistered host).  But the "mcount" shell script that
gets called, which inserts a count of messages waiting, also is the
place where I conceptually have in mind to state the name of the correct
account that was written to.

Here is a piece of that Bourne-shell script that I just wrote and
put in as a patch to what I had before:

  case "$SOURCE" in
      emh11)
          MAILUSER=rossd
          MAILHOSTNAME=heidelberg-emh11.army.mil ;;
      urz)
          MAILUSER=o30
          MAILHOSTNAME=ix.urz.uni-heidelberg.de ;;
      ccc)
          MAILUSER=dross
          MAILHOSTNAME=ccc.wbn.army.mil ;;
      netcom)
          MAILUSER=dman
          MAILHOSTNAME=netcom.com ;;
      *)
          MAILUSER="${USER:-${LOGNAME:-`basename $HOME`}}"
          MAILHOSTNAME="${HOSTNAME:-mwr1.heidelberg.army.mil}" ;;
  esac

  SPOOL="${MAIL:-/var/spool/mail/$USER}"


In short, any good ideas would be appreciated re. how to
continue.


3) A third question has to do with the sed statement from the
vacation recipe that replaces the subject with the current
subject in my auto-reply.  It reads (also shown above)

        sed "s/\$SUBJ/$SUBJ/" $HOME/etc/.acknowledgment

I just noticed that in mail that came with an ampersand already
in the subject, though, that caused the sed statement to reflect
back the rest of the line where the ampersand was.

For example, if I trigger the auto-reply on myself and
use "&" in the subject with

        Subject: This & That

I get back

        Meanwhile, please know that Dallman will answer your mail on
        "This $SUBJ That" at his earliest opportunity.


Ideas on how to resolve that one?

Thanks!

--
Dallman Ross, IMO, ISSO
Supervising Programmer-Analyst
26th Area Support Group - S1 Automation Branch
DSN: 373-6779 . Civ.: 011-49-6221-176779
<rossd(_at_)heidelberg-emh11(_dot_)army(_dot_)mil>


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