procmail
[Top] [All Lists]

Problem with vacation

1998-07-03 03:10:38

Hi all,

        I get the following error message when I try Alan Stebbens'
ackmail.rc vacation responder:

## formail: formail: cannot open

Before you ask, yes I *do* have the path to formail in the PATH variable.

I also tried the vacation recipe from the procmailex man page and I get
exactly the same error message. I have permissions on the vacation file
set at 700. Can anyone help? I've attached Alan's recipe to this post.

Cheers,
Bernard

"When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl."

MY_ADDR=belhagin(_at_)bya1c87(_dot_)pl(_dot_)lucent(_dot_)com
NOACKS=(_dot_)*(_at_)lucent(_dot_)com
MY_NAMES=${MY_NAMES:-${SIGNATURE:-`cat $HOME/.signature 2>/dev/null`}}
ACKS=${ACKS:-ackmail.cache}
ACKMSG=${ACKMSG:-ackmsg}
VACAMSG=${VACAMSG:-vacation.msg}
FROMSIG=${FROMSIG:-"Mailer-Daemon of $USER"}
NOACKS=${NOACKS:-$MY_ADDR}
NOACKFILE=${NOACKFILE:-''}

PRE_ADDR_SPAN='(.*[^-((_dot_)%(_at_)a-zA-Z0-9])?'
POST_ADDR_SPAN='(([^),.!:a-zA-Z0-9].*)?(,|$[^>]))'
FROMHDR="(^(((Resent-)?(From|Sender)|X-Envelope-From):|>?From )$PRE_ADDR_SPAN)"



:0
* ? test -f ackmail.rc.log
{ 
  OLDACKLOGFILE=$LOGFILE
  LOGFILE=ackmail.rc.log 
  LOGABSTRACT=all
  VERBOSE=on
}

# Get the best return address without names & comments.
# This will be the same address we respond to.
SENDER=`formail -rtzx To:`

# Define a list of well-known list mailer addresses
LIST_MAILERS='((Mail(er)?-?)?daemon|root|LISTSERV|ListProc|\
[a-zA-Z0-9-]+-(list|request|owner)|(owner-)?list-[a-zA-Z0-9-]+|\
Majordomo|Mailagent|Postmaster|mmdf|news|n?uucp)'

# This is the major condition by which we decide to respond
# or not.

:0ch
* $ ^TO($USER|$MY_ADDR|$MY_NAMES)
*  ? test -f $ACKMSG -o -f $VACAMSG
* ^Subject: vacationtest
*  !^FROM_DAEMON
* $! SENDER ?? $LIST_MAILERS
* $! $FROMHDR(Majordomo|Listserv)
*  !^Subject: .*(\[(ack(nowledge?ment)?|on vacation)\]|\
                auto(matic)[- ]reply|\
                away from mail|\
                out of town|\
                can ?not (reply|answer)|\
                (on |via )vacation( program)?)
* $!^X-Loop: *$MY_ADDR
* $!$FROMHDR($NOACKS)$POST_ADDR_SPAN
{
    # Okay -- we're doing to do the auto-ack or vacation mail
    #
    # We're forking for the auto-ack, shut up comsat, and assume that,
    # in this process, the mail is delivered
    DELIVERED=yes
    COMSAT=off

    # Don't output logfile info; the user can query $ACKS to see which
    # users have been acknowledged.  This only affects the child
    # process.
    LOGABSTRACT=no

    # Check for a NOACKFILE; if it exists, and if the sender matches one
    # of the regexps within the NOACKFILE, then do not ack this mail
    :0h
    * ? test -n "$NOACKFILE" -a -f "$NOACKFILE"
    * ? echo "$SENDER" | egrep -s -f "$NOACKFILE"
    { HOST=_do_not_ack_this_user }

    # Check the mail to see if we have replied recently, and if so, if
    # we should reply again
    DATE=`date +'%D'`

    # Get the subject
    :0 ch
    SUBJ=| formail -zX'Subject:' | sed -e 's/["~]//g' -e 's/^ *[Rr]e: *//g'
    SUBJ="${SUBJ:-'(no subject)'}"

    # Get which file: "vacation.msg" has precedence over "ackmsg"
    :0
    * ? test -f $VACAMSG
    { ACKFILE=$VACAMSG  ACKM='on vacation' }
    :0 E
    { ACKFILE=$ACKMSG   ACKM='acknowledgment' }

    # Check the cache for a recent ack (a successful grep "delivers" the
    # mail)
    LOCKFILE=$ACKS.lock
    :0 Wh
    | fgrep -i -s "$SENDER $DATE" $ACKS

    # Not in the $ACKS file; add it
    JUNK=`(fgrep -i -v "$SENDER" $ACKS ; echo "$SENDER $DATE" ) >$ACKS.new ;
          rm -f $ACKS ; mv $ACKS.new $ACKS `

    # Release the lock
    LOCKFILE
    
    # Replace the headers with a reply

    # (Note: do not use -k here; "h" recipes include the blank
    # line in the headers, and formail -r generates a blank line
    # also.  If you use '-k', then the original blank line will 
    # be kept, and the additional will be added, resulting
    # in two blank lines).

    :0 fhw
    | formail -rtI"From:       $FROMSIG" \
                -I"Reply-To:   $MY_ADDR" \
                -I"Precedence: junk" \
                -I"Subject:    Re: $SUBJ [$ACKM]" \
                -I"X-Loop:     $MY_ADDR" \
                -I"References:"

    # If formail failed, it is because it couldn't be found
    # avoid acks in this case
    :0 e
    { LOG="****Error: Formail failed in ackmail.rc at `date`
"
      HOST=_stop_processing_now
    }
      
    # Replace the body with the ack message
    :0 fbw
    | cat $ACKFILE

    # If the cat $ACKFILE failed, it is probably because ackfile can't
    # be read; in this case, create a reasonable reply
    :0 efb
    | echo "Your mail concerning '$SUBJECT' was received." ; \
      echo "I'll reply to it as soon as I can."

    # Now maybe do some substitutions, depending upon whether or not the
    # particular strings exist.
    :0 fBb
    * $SUBJECT
    | sed -e "s~\$SUBJECT~$SUBJ~g"

    :0 fBb
    * $SENDER
    | sed -e "s~\$SENDER~$SENDER~g"

    # If the string $UNREAD is in the message, then figure out
    # how many unread messages and substitute it
    :0 B
    * $UNREAD
    { 
      UNREAD=no                 # by default

      # Define the MUA if it isn't defined already
      :0
      * MUA ?? !.+
      * ? test -f guess-mua.rc
      { INCLUDERC=guess-mua.rc }

      # For any MUA keyword, there should be a corresponding
      # unread-$MUA.rc file.
      :0
      * MUA ?? .+
      * ? test -f unread-$MUA.rc
      { INCLUDERC=unread-$MUA.rc }

      # Finally, substitute UNREAD into the current body
      :0 fb
      | sed -e "s~\$UNREAD~$UNREAD~g"
    }
        
    # Finally, deliver it
    :0 w
    ! -oi -t
    
    HOST=end_of_processing      # just in case sendmail failed
}

# Undo any debug logging
:0
* LOGFILE ?? ackmail\.rc\.log
{ 
  VERBOSE=no
  LOGABSTRACT=yes
  LOGFILE=$OLDACKLOGFILE
  OLDACKLOGFILE
}