procmail
[Top] [All Lists]

Odd ball procmail usage works, mostly...

1997-06-05 07:59:00
    First off, let me apologize for not including a verbose log with this
    question, but the problem happens so infrequently, that I can't justify
    doing that given the disk space shortage on this particular machine. 
    What I'm hoping is that someone will easily recognize what may be a
    common problem or mistake from just the error message and script.

    We have a system for managing sendmail aliases that lets people create
    an alias for themselves.  The info is stored in a home grown database
    which is used to build the alias file.  I am using ProcMail to do an
    auto-response for aliases that have either been retired, or where the
    person's address has changed.  For example, the alias Dutch.Culver is
    set to:

        "|/procmail -m /AR/aliasfwd dutch(_at_)xyz(_dot_)ultranet(_dot_)com 
22-JUL-1997"

    The parameters being passed to the ProcMail script aliasfwd are the
    person's new address and the date that this forwarding alias will
    expire.

    Here's what the aliasfwd ProcMail script looks like:

- - - - - - - - - - 8< - - - - - - - - - - - - - - - - aliasfwd - - - - - - - -
# File: /usr/users/MailMan/AR/aliasfwd (a.k.a. /AR/aliasfwd)
# Desc: Auto forward a message to an alias to its new address.
# See /AR/responder.doc for more info.

LOGFILE=/usr/users/MailMan/AR/aliasfwd.log      # Put logs here.
LOGABSTRACT=no                                  # Turn off default abstracts,
                                                #   we do our own.
#VERBOSE=on                                     # Tell us the gory details.
COMSAT=off                                      # No need to notify anybody.

#-----------------------------------------------+
# Extract header information from message.      |
#-----------------------------------------------+

SUBJECT=`formail -zxSubject:`
OLDADDR=`formail -zxTo:`
MSGDATE=`formail -zxDate:`
NEWADDR=$1
EXPIRES=$2
OSENDER=`formail -zxFrom:`
LOG="-----
From: $OSENDER
  To: $OLDADDR (destined for $NEWADDR)
  On: $MSGDATE
Subj: $SUBJECT
"

#---------------------------------------+
# First, forward the message to the new |
# address.                              |
#---------------------------------------+

:0c
! $NEWADDR


#---------------------------------------+
# Now compose a reply to the sender...  |
#---------------------------------------+

:0fh
| formail -rt -I"From: Alias(_dot_)Admin(_at_)unh(_dot_)edu" \
              -I"Subject: Regarding your message sent to $OLDADDR" \
              -I"Reply-to: Alias(_dot_)Admin(_at_)unh(_dot_)edu" \
              -I"Errors-to: Alias(_dot_)Admin(_at_)unh(_dot_)edu" \
              -A"X-Loop: $LOGNAME(_at_)$HOST - aliasfwd"

:0fb
| echo "     Your message"; \
  echo ""; \
  echo "> Subj: $SUBJECT"; \
  echo ""; \
  echo "     that was originally mailed to the old UNH address:"; \
  echo ""; \
  echo "           $OLDADDR"; \
  echo ""; \
  echo "     has been automatically fowarded to the new address:"; \
  echo ""; \
  echo "           $NEWADDR"; \
  echo ""; \
  echo "     Please make a note of this new address and use it in all"; \
  echo "     future correspondence.  Messages sent to the old address"; \
  echo "     will no longer be accepted or forwarded after $EXPIRES."; \
  echo ""; \
  echo ""; \
  echo "                                         Virtually yours,"; \
  echo "                                         The Alias Server Admin";

#---------------------------------------+
# ...and send it back.                  |
#---------------------------------------+

:0
! -oi -t

DELIVERED=yes
- - - - - - - - - - 8< - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    I have 5 different scripts that are all simple variations on this
    basic theme.  

    This mechanism has been working well for us, although every once in a
    while I'll see an error like the following in the log file:

- - - - - - - - - - 8< - - - - - - - - - - - - - - - - a log entry - - - - - -
From: mi14(_at_)cornell(_dot_)edu
  To: BOTSWANA(_at_)mathcs(_dot_)duq(_dot_)edu (destined for 
nyasanet-REQUEST(_at_)maelstrom(_dot_)stjohns(_dot_)e
du)
  On: Fri, 25 Apr 1997 22:12:50 -0400 (EDT)
Subj: CREATION OF A PAN-AFRICAN SENATE: A CALL FOR ACTION
procmail: Error while writing to " echo "     Regarding your message"; \
  echo ""; \
  echo "> Subj: $SUBJECT"; \
  echo ""; \
  echo "     that was originally mailed to the old ListMgr address:"; \
  echo ""; \
  echo "           $OLDADDR"; \
  echo ""; \
  echo "     This list is no longer hosted on this system.  Your message"; \
  echo "     has been automatically fowarded to the list owner at the"; \
  echo "     new list owner address:"; \
  echo ""; \
  echo "           $NEWADDR"; \
  echo ""; \
  echo "     The list owner will be able to help you with any questions"; \
  echo "     you may have about your subscription or the list's new"; \
  echo "     address.  Please note that messages will no longer be"; \
  echo "     accepted or forwarded by this old address after 30-JUN-1997."; \
  echo ""; \
  echo ""; \
  echo "                                         Virtually yours,"; \
  echo "                                         The List Server Admin";"
procmail: Rescue of unfiltered data succeeded
- - - - - - - - - - 8< - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    My guess is that funny characters in the $SUBJECT or other variables
    are breaking the echo command.  Or???   Any suggestions as how to fix
    this or recommendations for a better, more robust approach?

    Thanks in advance....

                                                        Later....BC

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