procmail
[Top] [All Lists]

Re: getting rid of the body of an e-mail

1996-04-27 18:03:11
Das Devaraj <das(_at_)netcom(_dot_)com> writes:
A part of my .procmailrc file is shown below.  I am trying to generate an
acknowledgement message when somebody sends a message to 
user1(_at_)foo(_dot_)com
(other ids in the same domain have different recipes). "HdrLine" is a file
containing the from line and "AutoMsg" is a file containing the canned
message which goes back to the sender. 

The problem is that the return message contains the complete text of the
original message.  Shouldn't the "h" flag pipe only the headers?  What am
I overlooking? 

:0 hc
* ^To:(_dot_)*user1(_at_)foo(_dot_)com
{
  MAILDIR=$HOME/fileserver
  :0 fhw 
  | formail -rA "X-Loop: Processed_Mail"
  :0 a
  | cat ./HdrLine - ./AutoMsg >&1 | $SENDMAIL -oi -t
}


The following flags have no effect on blocks: h b f i w W r
In fact, procmail should be warning you of this in your LOGFILE.  You
did turn on verbose logging and check the logfile when something didn't
work, right?  :-)

The solution is to move the 'h' flag from the outer block to the last
action (after the 'a' flag).

You _probably_ also want to be using the ^TO or ^TO_ macros (see the
MISCELLANEOUS section of the procmailrc(5) manpage) in the condition.

I'm not sure what you intend the ">&1" to do.  If you mean to make
stderr from the 'cat' command go to stdout (into the sendmail), then
it should be "2>&1".

Hmm, staring some more, is there some reason you don't combine the two
inner recipes?


# ^TO_ showed up in version 3.11pre1 (I think).  Before then use ^TO
:0 c
*   ^TO_user1(_at_)foo(_dot_)com
* ! ^X-Loop: Processed_Mail
{
    MAILDIR = $HOME/fileserver
    :0 h
    | formail -rA "X-Loop: Processed_Mail" | \
        cat ./HdrLine - ./AutoMsg 2>&1 | \
        $SENDMAIL -oi -t
}



Philip Guenther

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