procmail
[Top] [All Lists]

cat and echo problem

2000-11-02 00:48:14
I need some help with my recipe. It is supposed to append a line to the top of 
the message body and forward a copy of any mail sent to 
webmaster(_at_)usatfne(_dot_)org to my e-mail address at work. I receive the 
forwarded mail at work with the correct headers but the appended line in the 
body is missing.

I'm puzzled because, until I made some "simple changes", the line did appear. 
The same code seems to work on my other account (at a different ISP.)

Here's the recipe:

  :0
  *$ ! ^$MY_XLOOP
  *  ! ^FROM_DAEMON
  {
    :0 c:
    ${DEFAULT}

    :0 fhw
    | cat - ; \
    echo "======= Forwarded Mail from webmaster(_at_)usatfne(_dot_)org 
=========="

    :0 fhw
    | formail -A"X-Loop: kuo(_at_)world(_dot_)std(_dot_)com"

    :0
    !jkuo(_at_)meditech(_dot_)com
  }

I tried, but was unable to find the problem by commenting out a line at a time. 
I'm using an over version of Procmail (maybe 1995/10/29: v3.11pre4.) I included 
my full recipe and partial log below.

Thank you for your help.  --  Justin Kuo <kuo(_at_)world(_dot_)std(_dot_)com>

# Justin Kuo's `procmailrc' include file for use at the usatfne.org
# Updated Wednesday, November 01, 2000

VERBOSE      = "on"
LOGABSTRACT  = "all"
SHELL        = /bin/sh
MAILDIR      = $HOME/Mail/.
MSGPREFIX    = "msg."
PMDIR        = $HOME/Procmail/.
LOGFILE      = $PMDIR/log.`date +%y-%m-%d`
HOME_ADDRESS = "kuo(_at_)world(_dot_)std(_dot_)com"
MY_XLOOP     = "X-Loop: $HOME_ADDRESS"

# ========================================================================
# All of my "INCLUDERC" files go here.
# ========================================================================

INCLUDERC=$PMDIR/backup.rc
## INCLUDERC=$PMDIR/copy-to-work.rc

log="begin: copy-to-work.rc
"
log="shell =$SHELL"

:0
*$ ! ^$MY_XLOOP
*  ! ^FROM_DAEMON
{
  :0 c:
  ${DEFAULT}

  :0 fhw
  | cat - ; \
  echo "======= Forwarded Mail from webmaster(_at_)usatfne(_dot_)org =========="

  :0 fhw
  | formail -A"X-Loop: kuo(_at_)world(_dot_)std(_dot_)com"

  :0
  !jkuo(_at_)meditech(_dot_)com
}

log="end: copy-to-work.rc (should never get here)
"

# =========================================================
# end of .procmailrc file
# =========================================================


-----------  log  -----------

procmail: Assigning "HOME_ADDRESS=kuo(_at_)world(_dot_)std(_dot_)com"
procmail: Assigning "MY_XLOOP=X-Loop: kuo(_at_)world(_dot_)std(_dot_)com"
procmail: Assigning 
"INCLUDERC=/home/sites/site134/users/usatfne/Procmail/./backup.rc"
procmail: Assigning "LASTFOLDER=Backup/24"
procmail: Opening "Backup/24"
procmail: Acquiring kernel-lock
From jkuo(_at_)meditech(_dot_)com  Wed Nov  1 17:52:39 2000
 Subject: this test sent at 1851
  Folder: Backup/24                                                         825
procmail: Assigning "LASTFOLDER= cd Backup && rm -f dummy `ls -t * | sed -e 
1,100d`"
From jkuo(_at_)meditech(_dot_)com  Wed Nov  1 17:52:39 2000
 Subject: this test sent at 1851
  Folder:  cd Backup && rm -f dummy `ls -t * | sed -e 1,100d`               825
procmail: Assigning "log=begin: copy-to-work.rc
"
procmail: Assigning "log=shell =/bin/sh"
procmail: Match on ! "^X-Loop: kuo(_at_)world(_dot_)std(_dot_)com"
procmail: Match on ! 
"(^(Precedence:.*(junk|bulk|list)|(((Resent-)?(From|Sender)|X-Envelope-From):|>?From
 
)(.*[^((_dot_)%(_at_)a-z0-9])?(Post(ma?(st(e?r)?|n)|office)|(send)?Mail(er)?|daemon|mmdf|root|n?uucp|smtp|response|LISTSERV|owner|request|bounce|serv(ices?|er)|Admin(istrator)?)([^).!:a-z0-9].*)?$[^>]))"
procmail: Locking "/var/spool/mail/usatfne.lock"
procmail: Assigning "LASTFOLDER=/var/spool/mail/usatfne"
procmail: Opening "/var/spool/mail/usatfne"
procmail: Acquiring kernel-lock
From jkuo(_at_)meditech(_dot_)com  Wed Nov  1 17:52:39 2000
 Subject: this test sent at 1851
  Folder: /var/spool/mail/usatfne                                           825
procmail: Unlocking "/var/spool/mail/usatfne.lock"
procmail: Executing " cd Backup && rm -f dummy `ls -t * | sed -e 1,100d`"
procmail: Executing " cat - ; \
  echo "======= Forwarded Mail from webmaster(_at_)usatfne(_dot_)org 
==========""
procmail: Executing "formail,-AX-Loop: kuo(_at_)world(_dot_)std(_dot_)com"
procmail: [15215] Wed Nov  1 17:52:40 2000
procmail: Assigning "LASTFOLDER=/usr/sbin/sendmail jkuo(_at_)meditech(_dot_)com"
From jkuo(_at_)meditech(_dot_)com  Wed Nov  1 17:52:39 2000
 Subject: this test sent at 1851
  Folder: /usr/sbin/sendmail jkuo(_at_)meditech(_dot_)com                       
            863
procmail: Notified comsat: "usatfne@:/usr/sbin/sendmail 
jkuo(_at_)meditech(_dot_)com"
procmail: [15215] Wed Nov  1 17:52:40 2000
procmail: Executing "/usr/sbin/sendmail,jkuo(_at_)meditech(_dot_)com"

-----------  # # #  -----------

Justin F. Kuo, Programmer/Analyst, 781-774-5410
Medical Information Technology, Inc.
Mailstop: F4S75W, MEDITECH Circle, Westwood, MA  02090
<Prev in Thread] Current Thread [Next in Thread>
  • cat and echo problem, Justin F. Kuo <=